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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!