KEMBAR78
Assignment 5 | PDF
0% found this document useful (0 votes)
15 views1 page

Assignment 5

The document outlines an assignment focused on strings and lists in Python. It includes tasks such as writing functions to reverse strings, find the longest word in a list, manipulate lists of float numbers, and create new lists based on existing ones. Additionally, it emphasizes the use of list comprehension and avoiding certain built-in functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Assignment 5

The document outlines an assignment focused on strings and lists in Python. It includes tasks such as writing functions to reverse strings, find the longest word in a list, manipulate lists of float numbers, and create new lists based on existing ones. Additionally, it emphasizes the use of list comprehension and avoiding certain built-in functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

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"]

You might also like