Ask user to enter age, sex ( M or F ), marital status ( Y or N ) and then using following rules print their place of service.
if employee is female, then she will work only in urban areas.
if employee is a male and age is in between 20 to 40 then he may work in anywhere
if employee is male and age is in between 40 t0 60 then he will work in urban areas only.
And any other input of age should print "ERROR".
Answers
Answered by
5
def place_of_service(age, gender, married):
if age < 20 or age > 60:
return "Error"
if gender == "F":
return "urban areas"
if 20 <= age <= 40:
return "anywhere"
return "urban areas"
age, gender, married = int(input("age: ")), input("M/F: "), input("Y/N: ")
print(place_of_service(age, gender, married))
Answered by
4
Answer:
def place_of_service(age, gender, married):
if age < 20 or age > 60:
return "Error"
if gender == "F":
return "urban areas"
if 20 <= age <= 40:
return "anywhere"
return "urban areas"
age, gender, married = int(input("age: ")), input("M/F: "), input("Y/N: ")
print(place_of_service(age, gender, married))
Similar questions