Jan-02-2019, 06:33 PM
I am having trouble with this code and would like to know if someone can help me. I did what I could but please let me know if it needs to be edited.
2b) if else statement
# for each comment below, add the code
# create a bool type variable called hasValidID and set its value to be True
# create an int type variable called age and set its value to 35
# set up an if else statement that checks both the hasStudentID and age values
# if the hasStudentID value is True or the age is at least 65,
# print the message "eligible for discount"
# otherwise print the message "not eligible for discount"
print("Exercise 2b.")
hasValidID = True
age = int(input(35))
# 2c) if elif else statement
# for each comment below, add the code
# take input for a variable called grade, converting it to an int type
# set up a series of if / elif / else statements
# if the value of grade is at least 90, print "A"
# otherwise if the value of grade is at least 80, print "B"
# otherwise if the value of grade is at least 70, print "C"
# otherwise if the value of grade is at least 60, print "D"
# otherwise, print "F"
2b) if else statement
# for each comment below, add the code
# create a bool type variable called hasValidID and set its value to be True
# create an int type variable called age and set its value to 35
# set up an if else statement that checks both the hasStudentID and age values
# if the hasStudentID value is True or the age is at least 65,
# print the message "eligible for discount"
# otherwise print the message "not eligible for discount"
print("Exercise 2b.")
hasValidID = True
age = int(input(35))
# 2c) if elif else statement
# for each comment below, add the code
# take input for a variable called grade, converting it to an int type
# set up a series of if / elif / else statements
# if the value of grade is at least 90, print "A"
# otherwise if the value of grade is at least 80, print "B"
# otherwise if the value of grade is at least 70, print "C"
# otherwise if the value of grade is at least 60, print "D"
# otherwise, print "F"