In: Computer Science
Use Python
## Problem Set 3
- James is looking for his dream job, but has some restrictions.
He loves California and would take a job there if it paid over
40,000 a year. He hates Massachusetts and demands at least 100,000
to work there. Any other place he’s content to work for 60,000 a
year, unless he can work in space in which case he would work for
free.
- Write a program to capture the above statement
- For each of the following job offers, write down the output that
would be generated.
- location = "Massachusetts" pay = 50000
- location = "Iowa" pay = 50000
- location = "California" pay = 50000
- location = "U.S.S. Enterprise" pay = 1
- location = "California" pay = 25000
CODE :
OUTPUT :
Raw_Code :
locations = ["Massachusetts","lowa","California","U.S.S.
Enterprise","California"] #list of locations of job
offers
payments = [50000,50000,50000,1,25000]
#list of payents of job
offers
for (i,j) in zip(locations,payments):
#loop over the job locations
and payments
if(i=="California" and j>=40000):
#condition
to accept job at california
print("James will accept job offer
at ",i," for ",j)
elif(i=="Massachussets" and j>=100000):
#condition to accept job at
Massachussets
print("James will accept job offer
at ",i," for ",j)
elif(i!="California" and i!="Massachussets" and
j>=60000): #condition to accept job at other
places
print("James will accept job offer
at ",i," for ",j) #printing respect
output
else:
print("James will not accept job
offer at ",i," for ",j) #if he wont accept
*********Comment me for any queries and Rate me up***********