Question: 2 . Write a Python program to create a list. ( named YourName _ SID _ Lab 7 b . py ) : - Create
Write a Python program to create a list. named YourNameSIDLabbpy:
Create an empty list named mydList to store some elements:Ask user to input an element and store it in the mydList in sequentially;Every time you ask, tell the user which element is being input next;The user completes the input when Q or q is entered;Display the input values on a single line;Find the sum and the total number of odd integers in the list.
Hint: use while loop for user input and for loop for output display
Sample Program Output
CCIT Laboratory : Section
Input the elements to be stored in sequentially
Enter the th element; enter Qq when completed:
Enter the th element; enter Qq when completed:
Enter the th element; enter Qq when completed:
Enter the th element; enter Qq when completed:
Enter the th element; enter Qq when completed:
Enter the th element; enter Qq when completed:
Enter the th element; enter Qq when completed:
Enter the th element; enter Qq when completed:
Enter the th element; enter Qq when completed: q
The elements stored in mydList are:
The total sum of these elements is and the number of odd integers is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
