Step 1: The program should start out by asking the user how many fortune cookies they would like to buy.
Input Validation: Do not let the user enter a number of cookies less than zero
If the user inputs less than 5 cookies print a message similar to the following:
Example (user purchased 4 cookies):
Sorry you do not qualify for the Lucky Chinese Fortune Game.
You only purchased 4 cookies.
Cost of Cookies: $3.96
For only $0.99 and one more cookie you qualify to play, would you like to buy more cookies? Enter Yes or No.
If the user enters No (make sure their input works regardless of whether the user enters an upper or lowercase response):
Display the following and end the program: Thank you for eating at Lucky’s Chinese!
If the user enters Yes (make sure their input works regardless of whether the user enters an upper or lowercase response): ask them how many more cookies they would like, and go back to step 1 above.
If the user inputs 5 or more cookies go to Step 2:
Step 2
If the user has input 5 or more cookies they are eligible for the game.
First, Display something similar to the following:
Example (for 5 fortune cookies purchased):
Welcome to the Lucky Chinese Fortune Game!
Each of your 5 fortune cookies will be opened and your fortune will be read.
This is my code for it
print("Welcome to Lucky Chinese Fortune Game")
print (" How many fortunes would you like to buy?")
#get user input
x = input ()
valx = int (x)
#if the user didnt buy enough cookies use if/else condition
if (cookies > 5):
print ("\nSorry you do not qualify for the Lucky Chinese Fortune Game")
print (" you only purchased {} cookies.".format(valx))
print (" For only '$'0.99 and on more cookie you qualify to play,")
print ("Would you like to buy more cookies? yes or no:")
selection = ""
while selection ! = "yes" and selection != "2"
selection = raw_input("select yes or no")
if selection == "no"
print("Thank you for eating at Lucky's Chinese!")
else selection == 'yes':
print("\nHow many more cookies would you like to buy?")
#get user input
m = input ()
valm = int (m)
else: print ("Welcome to the Lucky Chinese Fortune Game!")

New Topic/Question
Reply



MultiQuote



|