Part 1: Congressional Conditional
(50 points)
In the United States, a citizen is eligible to be a US Senator who is at least 30 years old and has been a US citizen for at least 9 years. Also, a citizen is eligible to be a US Representative who is at least 25 years old and has been a US citizen for at least 7 years.
Write a script to obtain age and length of citizenship from the user and return to the screen via a print statement if the user is eligible to for the US Senate, the US House of Representatives, both or neither.
Create your script (congress.py) so it obtains age and length of citizenship from the user - the age and years of citizenship should not be assigned in the script, but rather use raw_input() to request the information from the user.
The script must return to the screen the correct response based on the age and citizenship years the user enters. One of the following three statements must be correctly printed to screen by the script:
- You are eligible for both the House and Senate
- You are only eligible for the House
- You are ineligible to serve
In addition to the user input for the Age and Citizen values, you must utilize a single Conditional Statement to compare BOTH values and return the correct statement. Using this information, complete the script below and submit via FSO:
# STUDENT NAME HERE # Python version 3.x.x # Congress Age Checker # input() allows the user to enter a value for the variable 'age' # "Enter Age: " is the prompt that will appear to the user when the script is executed age = input("Enter Age: ") # Using the above as a guide, complete the following line so that # "Enter Number of years as a US Citizen: " will appear when the script is executed citizen = # Conditional Statement # Using the variables 'age' & 'citizen', construct a conditional statement that will # check to see is the user is eligible for the Senate, House of Representatives, both or neither. # To help you get started the first condition has been provided for you if ___ >= 30 and citizen >= 9: print "You are eligible for the Senate and the House " ____ age >= 25 and citizen >= __: print ("You are eligible for the House of Representatives.") else: print ("You are ineligible to serve.")
Part 2: Grade Conversion Conditional (50 points)
Write a script (grade.py) that will allow a user to enter a numerical score between 0 and 100 that will return (print to the screen) the Letter equivalent of the grade based on the following scale:
- 100 - 95 = A+
- 94 - 90 = A
- 89 - 85 = B+
- 84 - 80 = B
- 79 - 75 = C
- 74 - 70 = D
- Below 70 = F
Complete the script below so that it will convert the score entered by the user to the proper letter grade.
# STUDENT NAME HERE # Python version 3.x.x # Grade Conversion score = int(input("Enter assignment score: ")) if score >= 95: grade = "A+" elif score >= 90: grade = "A" # Complete this conditional statement using the rest of the scale # B+ # B # C # D # F print ("You earned a " + grade + " for this assignment.")