# Problem 1
# gets user input for how old they are. converts it to an integer because input is
# defaulted as a string
userAge = int(input("How old are you? "))
# gets user input to see if they are a U.S. citizen or not
userCitizen = input("Are you a U.S. citizen?('yes' or 'no') ")
# if else statement to check if the user is 18 or older and if they are a U.S. citizen
# if both are true, print you can vote
# if one of them isnt true, print you cant vote
if (userAge >= 18 and userCitizen == 'yes'):
print('You can vote!')
else:
print("You can't vote!")
You can't vote!
# Problem 2
# gets user input for what their yearly income is and converts it to an integer
# for calculation
userSalary = int(input("What is your yearly income?(no '$' sign) "))
# gets user input for how many years they served and converts it to an integer
# for the if else statement
userYOS = int(input("How many years have you served? "))
# if else statement to check if the user served more than 5 years
# if served more than 5 years, give them a 5% bonus to their salary
# if didn't serve more than 5 years, don't give them a bonus
if userYOS > 5:
# calculates the bonus to the salary
userBonus = userSalary * 0.05
# converts userBonus back to a string for string concatenation
print('You have a $' + str(userBonus) + ' bonus.')
else:
print("You don't qualify for a bonus.")
You have a $4500.0 bonus.
# Problem 3
# gets user input for their grade and converts it to an integer for the if else statement
userGrade = int(input("What is your grade percentage? (not grade letter and dont use percent) "))
# if else statements to check what percent the user's grade percentage is and what their grade is
if userGrade > 80:
print('You have an A')
elif userGrade <= 80 and userGrade > 60:
print('You have a B')
elif userGrade <= 60 and userGrade > 50:
print('You have a C')
elif userGrade <= 50 and userGrade > 45:
print('You have a D')
elif userGrade <= 45 and userGrade > 25:
print('You have a E')
else:
print('You have an F')
You have an A
##