mardi 26 mars 2019

Error During If and And-or-not Statements

For my assignment I needed to create a club and have requirements that the user has to answer via three inputs, and I also need to include an if statement and an and-or-not statement. I sorted everything out and it was working swimmingly until the and-or-not statement. I am learning via an online class, and I just briefly learned the and-or-not statements. They showed examples using numbers and two options, but I have way more and they're word options. I am not sure if I am coding it properly, because even if the person enters false values, it still outputs as if it were a true value. Any advice to fix the issue?

#Module Four Project
#3/23/19
#Create a program that asks the user questions to see if they meet the club requirements

def main(): 

    age = input("How old are you?")
    job = input("What is your job?")
    major = input("What did you major in college?")

    print("This is the Programmers Only Club!")
    print("")
    print("Thank you for filling out our quick admission form! :)")
    print("")

    print("Your answers to our form:")
    print("Age: " + str(age))
    print("Profession: " + str(job))
    print("College Major: " +(major))
    print("")
    print("We appreciate you filling out the form and your appreciation for programming.")
    print("")

    if (major == "computer science" or "Computer science" or "Computer Science" and job == "programmer" or "Programmer" ):
        if( age >= 18):
            print("Welcome, you meet the requirements to join the club!")
    else:
        print("Unfortunately, you do not meet all of the requirements to be in the Programmers Only Club :(")

main()

Aucun commentaire:

Enregistrer un commentaire