solution

Design and write the Python code for a program that asks the user for their name and 3 simple questions. Then use at least 3 decision structures to display custom output based on what the user has entered. Be as creative as you want with your questions and outcomes.

The program must:

  • use at least 3 decision structures (if/else or if/elif/else)

  • have at least 3 different possible outcomes

Note: Input validation is not required, so assume the user will enter answers that make sense for the questions you ask.

Example concept:

This program asks the user their name and 3 questions, then uses 3 separate if statements to display 5 possible messages based on the answers given by the user.
”’

Display ‘Please enter your name: ‘
Input username

Display ‘Hello, ‘ + username + ‘! How old are you?’
Input user_age

Display ‘Do you like pizza or pasta?’
Input dinner

Display ‘How much money do you want to spend on dinner?’
Input dinner_cost

If user_age > 21
If dinner == ‘pasta’
If dinner_cost > 50:
Display ‘Wow, ‘ + username + ‘, big spender! We’re going to Olive Garden and spending $’ + dinner_cost + ‘ on ‘ + dinner + ‘ tonight!’)
Else:
Display ‘Well, ‘ + username + ‘ I guess we can get some frozen ‘ + dinner + ‘ at the gas station for $’ + dinner_cost + ‘…’)
Elif dinner == ‘pizza’:
Display ‘I know a fancy ‘ + dinner + ‘ place with a $’ + dinner_cost + ‘ special that includes drinks and a side!’)
Else:
Display ‘I’ve never heard of ‘ + dinner + ‘ but we can buy $’ + dinner_cost + ‘ worth of groceries and make it!’)
Else:
Display ‘Is $’ + dinner_cost + ‘ all you get for allowance, ‘ + username + ‘? We have to ask my parents before we can get ‘ + dinner + ‘ tonight.’)
#End if structure

Display ‘Thanks for dinner, ‘ + username + ‘!’)

#End program

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
Looking for a Similar Assignment? Our Experts can help. Use the coupon code SAVE30 to get your first order at 30% off!