Author name: PythonCSIP CS IP

7. Write a program that rotates the elements of a list so that the element at the first index moves to the second index, the element in the second index moves to the third index, etc., and the element in the last index moves to the first index.

# Code l = input().split() # input().split() returns the list l = l[len(l)-1:] + l[:-1] # last element being added at the start with the list slice that doesn’t contain the last element print(l)

7. Write a program that rotates the elements of a list so that the element at the first index moves to the second index, the element in the second index moves to the third index, etc., and the element in the last index moves to the first index. Read More »

2. Write a program that should prompt the user to type some sentence(s) followed by “enter”. It should then print the original sentence(s) and the following statistics relating to the sentence(s) :

* Number of words * Number of characters (including white-space and punctuation) * Percentage of characters that are alpha numeric Hints * Assume any consecutive sequence of non-blank characters is a word. # Code s = input(‘Enter a sentence : ‘) number_of_words = 1 number_of_characters = len(s) al_num = 0 for i in s: if

2. Write a program that should prompt the user to type some sentence(s) followed by “enter”. It should then print the original sentence(s) and the following statistics relating to the sentence(s) : Read More »