PYTHON SCRIPT
Your parents have promised to buy you a game system depending on your grade point average (GPA). If your GPA is in between 3.0 and 3.5, inclusive, then you will get a Wii. If your GPA is greater than 3.5 but less than or equal to 3.8, you will get a Kinect. If your GPA is greater than 3.8, you will get a Playstation 3. Write a program that prompts the user for their GPA and prints out which game system, if any, they will get.
Sample Program Run #1
What is your GPA?
2.8
Sorry, you do not get a game system.
Sample Program Run #2
What is your GPA?
3.6
Great, you will get a Kinect for your good grades!
n=float(input("What is your GPA?"))
if n>3.0 and n<=3.5:
print("Great,you will get a Wii for your good grades!")
elif n>3.5 and n<=3.8:
print("Great,you will get a Kinect for your good grades!")
elif n>3.8:
print("Great,you will get a Playstation 3 for your good grades!")
else:
print("Sorry,you do not get a game system.")
Explanation:
GPA is a float value so we convert from string to float
and stored in the n and compare the n according to the given conditions.
: is required at the if conditions and python follows indentation.
Get Answers For Free
Most questions answered within 1 hours.