Question
In the following three problems make sure you use a main() function. But, you dont have to use additional functions unless you want to. (+5
In the following three problems make sure you use a main() function. But, you dont have to use additional functions unless you want to. (+5 points Extra Credit for a design on any one of the problems.
No design required - Given the following list:
myList = ["Hello", "name", 6, 3.1, 7.2, 9.4, "Good bye", 11.1, 22]
Write a program that will total the numbers only.
(Hint: See my slide 21 to determine the type of a variable)
No design required:
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 and add another word. Then, input each word into a list.
Then, outside the loop, when the user said no 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). See documentation of random, if you need help, at: HYPERLINK "https://docs.python.org/3/library/random.html?highlight=random%20choice" \l "random.choice" https://docs.python.org/3/library/random.html?highlight=random%20choice#random.choice
No design required. Write the following program. The program should fill a list with integers that the user provides.
In first loop make sure the loop will continue 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, 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