Question
IN PYTHON 3+ Q1) Write a program that reads a list of words (make sure the input statement is inside a loop). Keep asking the
IN PYTHON 3+
Q1) Write a program that reads a list of words (make sure the input statement is inside a loop).
Keep asking the user if they want to continue adding another word, until they say N. Make sure you input each word into a list.
Then, outside the loop, when the user said N to more inputs. Select a random word from the list and print it out. You will need to use the function random.choice(alist) and don't forget the import statement (import random)
Q2) Write the following program. The program should fill a list with integers that the user provides.
You should have a loop that continues if the user wants to do the program multiple times.
In an inner loop, ask the user to input an integer value, test each value to make sure it is an integer with the try-except we used last week, then put each value into a list. Then ask the user if they want to enter another value.
When you are done entering the values in the inner loop:
Sum all the integers in the list and print the result (with words, dont just say a number).
Find the largest and smallest value - you can use max( ) &min( ) and print the results.
Sorts the list - print the result
Make sure you have a main().
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started