Taking a beginner course in Python and have this question:
Jake is looking for a job but has some conditions. He would love a job in Hawaii and would accept it if it pays more than 40,000 per year. He does not like New York but would take a job if it pays more than 100,000 per year. He would work anywhere else if it pays more than 60,000. Write a program that prompts the user to enter two input values, location and pay, and returns
(1) "I'll take it!" if the user entered Hawaii and more than 40000, New York and more than 100000, or anywhere else with pay more than 60000, for the location and pay, respectively, or
(2) "No way." if the user enters Hawaii and less than 40000 or New York and less than 100000, for the location and pay, respectively, or
(3) "No thanks, I can find something better." if the location is anywhere else and the pay is less than 60000.
Using a boolean string to do so, but the final else
statement is not being recognized. How can that be fixed?
geo = input("Enter 2-letter state designation (i.e. Ohio is OH): ")
pay = input("Enter pay: ")
int_pay = int(pay)
if geo == ('HI') and int_pay > 40000:
print("I'll take it!")
elif geo == ('HI') and int_pay < 40000:
print("No way.")
if geo == ('NY') and int_pay > 100000:
print("I'll take it!")
elif geo == ('NY') and int_pay < 100000:
print("No way.")
if geo != ('HI') or ('NY') and int_pay > 60000:
print("I'll take it!")
else:
geo != ('HI') or ('NY') and int_pay < 60000
print("No Thanks, I can find something better.")
Output when geo
= CA
and pay
= 300
:
Enter 2-letter state designation (i.e. Ohio is OH): CA
Enter pay: 300
I'll take it!