Question
In python, Write a program that simulates a fortune telling program. The program should print a welcome message and instructions. The user should be prompted
In python,
Write a program that simulates a fortune telling program. The program should print a welcome message and instructions. The user should be prompted to input a number between 1 and 100. The program should generate a random number between 1 and 100. The program should respond with a fortune as follows:
Fortune 1: random number less than 51 and user number even
Fortune 2: random number less than 51 and user number odd
Fortune 3: random number greater or equal to 51 and user number even
Fortune 4: random number greater or equal to 51 and user number odd
The program must allow the user to continue to get fortunes until the user quits. Input must be validated to ensure the user enters a number between 1 and 100. All code must be contained in a function (except comments and import statements). The following structure is suggested:
printWelcome helper function that prints welcome and instructions
validate1To100 helper function that ensures the user provides a number between 1 and 100
returnFortune helper function that takes user number and random number and returns a fortune
main allows user to continue until quitting, uses the appropriate helper functions
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