Home / Expert Answers / Computer Science / start-with-ps5pr1-py-this-question-asks-you-to-implement-two-functions-rotate-once-and-rotate-n-pa558

(Solved): Start with ps5pr1.py. this question asks you to implement two functions, rotate_once and rotate_n. ...



Start with ps5pr1.py. this question asks you to implement two functions, rotate_once and rotate_n. Rotate_once takes a list as parameter and rotate it once. Rotate_n takes a list and number k as parameters. It should rotate the list k times. A rotation is shifting each element one position ahead, and put the first element moved to the end of the list. For example, if you call rotate _once ([1,2,3]) the return should be ([2,3,1)]. If you call rotate_n ([1,2,3],2) the list should perform two rotations. The first rotation gets [(2,3,1)] and the second rotation gets [(3,1,2)] so the return should be [(3,1,2)].



We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe