Exercise 4 Name your program Lab11_ex4_Id.py Write a program that that reads values from the keyboard and stores them in a list. Your program then asks the user to enter a positive number n and then...


Exercise 4 Name your program Lab11_ex4_Id.py<br>Write a program that that reads values from the keyboard and stores them in a list. Your program<br>then asks the user to enter a positive number n and then shifts n times the contents of the list<br>elements one element to the right, with the last element moved to the left end. If you run your<br>program with the following input data:<br>76, 89, 100, 90, 90, 100, 76, 100, 90, 87<br>Your output should be as follows:<br>Before: 76 89 100 90 90 100 76 100<br>90 87<br>Enter a positive number: 2<br>After: 90 87 76 89 100 90 90 100 76 100<br>Your program should have at least these 3 functions:<br>1. main(): reads a number from the user, displays the list before shifting, and the list after<br>applying the shift<br>2. readData():reads data from the keyboard into a list<br>3. shiftList(list, n): takes a list of numbers and shifts it n times<br>

Extracted text: Exercise 4 Name your program Lab11_ex4_Id.py Write a program that that reads values from the keyboard and stores them in a list. Your program then asks the user to enter a positive number n and then shifts n times the contents of the list elements one element to the right, with the last element moved to the left end. If you run your program with the following input data: 76, 89, 100, 90, 90, 100, 76, 100, 90, 87 Your output should be as follows: Before: 76 89 100 90 90 100 76 100 90 87 Enter a positive number: 2 After: 90 87 76 89 100 90 90 100 76 100 Your program should have at least these 3 functions: 1. main(): reads a number from the user, displays the list before shifting, and the list after applying the shift 2. readData():reads data from the keyboard into a list 3. shiftList(list, n): takes a list of numbers and shifts it n times

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here