vendredi 10 septembre 2021

How can I fix this code and add input inside the Elif statement?

Please find the code below:

x = input("Enter your name: ")
y = input("Enter your field: ")
print("Hello %s,You have a very interesting Field" % x)
print("Here are the future options for all the careers related to %s:"% y)
if y == "commerce":
    print("A.Chartered accountant\nB.Civil Services\nC.Accountant\nD.company Secretary\nE.Financial Analyst\nF.Auditor")
elif y == "biology":
    print("A.Doctor\nB.pharmacist\nC.Chemist\nD.Scientist")
elif y == "engineering":
    z == input("Enter Stream: ")
    if z == "Mechanical":
        print("Mechanical Engineer")
    elif z == "computer science":
        print("A.Software Engineer\nB.Data Scientist\nC.Programmer")
else:
    print("I suppose you've entered Arts,YOu can opt for a career in\nA.IAS\nB.Music\nC.Political Science")

I do not understand the error in logic, I mean it makes perfect sense but some how it shows syntax error in the nesting code. Is there any way I can solve this without changing the method?

Aucun commentaire:

Enregistrer un commentaire