1 Introduction to Information Technology
ASSIGNMENT 5: STRINGS AND LISTS
1. Write a function that reverses a string.
2. Write a Python function that takes a list of words and returns the length of the
longest one.
3. Write a program that prompts the user to enter a list of N float numbers a0, a1,….,
aN-1:
a. Input N float numbers from keyboard
b. Print the list in reverse order
c. Insert a new element to the end of list
d. Find index of the first occurrence of element X in the list, where element X
is entered from keyboard.
e. Print all indexes of occurrences of element X in the list
f. Remove all elements X in the list
g. Sort the List in ascending / descending order
4. Given a list of numbers a0, a1,…., an-1. Write the functions to returns a new list such
that the new list contains all the elements of the old list in reverse order. Note: Do
NOT use the reverse() or sort() in library.
5. Given a list of strings. Write a program to create a new list that contains all the
elements of old list in lower case (using list comprehension).
For example:
old_list = ["Hello", "WORLD", "IN", "Python"]
new_list = ["hello", "world", "in", "python"]