1. Write a Python program named LastnameFirstname06.py, using your last name and your first name, that does the following:
Ask the user for their name, then say hello, addressing the user by name
Ask the user if they'd like to win a random prize. If the user says no, say goodbye and have the program end.
If the user says yes, ask the user to enter the year, month, and date they were born.
Generate a random number to represent the number of possible prizes the user can win. The number of possible prizes should be at least 3.
In the example below, I generate a number between 25 - 27. If the number is 25, the user wins money; if the number is 26, the user wins vegetables; if the number is 27, the user wins a computer.
Depending on the random number generated, print what prize the user has won. For each prize, incorporate math methods that use the year, month, or date that the user entered.
In the example below, the monetary prize is calculated by using math.pow with the year and month data (i.e. it calculated 1900 to the 1 power: 1900^1). Feel free to use any math method and any of the year/month/date information.
Remember! Never trust your user. Remember to account for the possibility of them not following your instructions. If they don't follow your instructions, do something about it! (such as ending the program)
Use at least one constant
2. Be sure to add comments for each section of your code.
3. Make sure your output is descriptive. Make sure it's clear to the user what your program is doing.
4. Your program should not use code/concepts we have not yet covered. You must demonstrate that you have mastered the concepts covered in class.
5. Remember to always begin your code with the following documentation comments:
Expected Output
>>> =============== RESTART: ManuelNikki06.py =============== Hello! What's your name? Nikki What's up, Nikki! Today's your lucky day because I have a box with a random prize in it! Do you wanna open the box? Please type yes or no: yes
Sweet! You can win one of the following: - money - a new computer - broccoli :) Your prize depends on your birthdate! Please enter the year you were born: 1900 Please enter the month you were born (as a number from 1 to 12): 1 Please enter the day you were born (as a number from 1 to 31): 26
Okay, let's open up this box and see what's inside...
You win... MONEY !!!!!!!!!!!!!! $1900.00 to be exact. Enjoy! :)
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.