0% found this document useful (0 votes)
12 views

Problems Based on Python List Data Structures

Uploaded by

rajashreesabale4
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Problems Based on Python List Data Structures

Uploaded by

rajashreesabale4
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Problems Based on Python List Data Structure

Question 1
Create a list of five sports. Ask the user what their favourite sport is other than the five sport already in the
list and add this to the end of the list. Sort the list and display it. Ask the user which sport they don’t like.
Delete the sport they have chosen from the list before you display the list again.

Question 2
Enter a list of ten colours. Ask the user for a starting number between 0 and 4 and an end number
between 5 and 9. Display the list for those colours between the start and end numbers the user input.

Question 3
Create a list of four three-digit numbers. Display the list to the user, showing each item from the list on a
separate line. Ask the user to enter a three-digit number. If the number they have typed in matches one in
the list, display the position of that number in the list, otherwise display the message “That is not in the
list”.

Question 4
Create the following using a simple 2D list using the standard Python
indexing:
• Using the 2D list from program, ask the user to select a row and a column
and display that value.
• Using the 2D list, ask the user which row they would like displayed and
display just that row. Ask them to enter a new value and add it to the end
of the row and display the row again

Question 5
Create a list containing the titles of four TV programmes and display them on separate lines. Ask the
user to enter another show and a position they want it inserted into the list. Display the list again,
showing all five TV programmes in their new positions..

Question 6
Ask the user to enter the names of three people they want to invite to a party and store them in a list. After
they have entered all three names, ask them if they want to add another. If they do, allow them to add
more names until they answer “no”. When they answer “no”, display how many people they have invited
to the party.
Note : This assignment will need looping statement. Therefore, you may solve this problem later after we
discuss looping construct.

Impetus IT Services Pvt.Ltd.


B-16, First floor, Sant Tukaram Vyapar Sankul, Sector - 24, Nigdi, Pune, Maharashtra. India. Pin – 411044.
Mobile 9970600774, 9730012775|Board 91-20-27640406|Fax 91-20-27641703
Email : [email protected] | Website : www.impetusits.in

You might also like