Close
Close

help me solve this if emplo

   monah

2.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".

  • age=int(input('enter your age:')) maritial_status=input('Are you Married(Y/N):').lower().strip() sex=input('enter your gender (M/F):').lower().strip() if sex =="f": if age>=20 and age<=60: print('you will work in urban area') else: print('eligible age for working is 20 to 60') elif sex=="m": if age>=40 and age<=60: print('you will work in urban area') elif age>=20 and age<=40: print('you will work anywhere') else: print('eligible age for working is 20 to 60')
    - Sathiyanarayanan

Answers

  •    Ayush-giri110

    age = int(input("enter your age"))

    gender = input("what is you gender if male type m if female type f")

    m_status = input("if married type y else type N")

    if gender=="f":

        print("you can only work in urban areas")

    elif gender=="m" and (age>=20 and age<40):

        print("you can work from anywhere")

    elif gender=="m" and (age>=40 and age<=60):

        print("you can work in urban areas only")

    elif not(age<20 and age>60):

        print("error")



  •    johnsmith885

    your post also helped me to solve my problem, thanks a lot slope game



Ask Yours
Post Yours
Write your answer