Question: Having trouble here importing modules into the program, any help is very much appreciated! What number am I thinking of ? Modularization Each sub program
Having trouble here importing modules into the program, any help is very much appreciated!
What number am I thinking of
Modularization
Each sub program should exist in its own module called by the main program, bonusproject.py
Main Program and Main Menu
Create a main menu that will execute each sub program or quit. Use input validation for the user selection. For example:
Example Output:
Main Menu
What number am I thinking of
KnockKnock
Card Dealer
Spreadsheet Statistics
Exit
Please enter a selection :
Subprograms
All sub programs should return to the main menu after completing their tasks. And they should exist in their own python module.
Create a random number between and Then prompt the user to enter a number between and If the number isn't the random number, it should tell the user to try again. If it is the number, then it should congratulate the user and ask the user if they would like to play again. If not, return to the main menu.
KnockKnock
Copy the following global constant.Choose a random knockknock from the list and use it to run the joke with the user. Use input validation to ensure the user answers correctly, if they don't then start over with the first knockknock prompt. After the user completes the joke, ask if they would like to hear another. If not, then return to the main menu.
Card Dealer
Prompt the user for the number of cards to randomly deal. Then print the cards represented by tuples of suits and numeric ranks represented like so:
Example Run:
How many cards should I deal?
You have a of hearts, a of spades, and a Jack of diamonds.
Use the following function to generate an unshuffied deck of cards represented as a list of tuples of strings and numbers for the suit and rank respectively.Notice that the rank of the card is represented by a number, but we want to print a string in the output. For example, is a jack, is a queen, and is a king. You will want to shufile the entire deck or choose card indices at random. If you choose random carc indices, you will need to track the chosen cards so that cards are not repeated. In other words, take care that the random indices into the unshuffled deck are all unique.
Spreadsheet Statistics
CSV files are a simple way to represent spreadsheets. You can export one from your favorite spreadsheet program or you can create one by hand. Here's an example of one for an inventory spreadsheet for a grocery store.
Item, Amount, Price,
Cookies,
Crackers,
Ham Sandwich,
Canned Tuna,
Canned Soup,
Create your own or copy the example and save as a csv file.
Ask the user to enter a file name of the csv file to load. If the file isn't found, then use input validation to ask the user again. Print sum and average statistics for the numeric columns. Ignore columns that aren't numeric like Item in our example. Ask the user if they would like to do another file. If not, then return to the main menu.
Example Output:
Enter a Csv file: groceries.csv
The sum of the Amount column is
The average of the Amount column is
The sum of the Price column is
The average of the Price column is
Would you like statistics for another file? yn n
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
