samedi 3 juin 2017

If and elif statement not

I was trying to make a simple survey bot, but I had trouble with the second if statement. it just ignores the if and elif, and goes straight to the else statement. I have tried everything, and even though it's probably going to be an easy solution please help...

import sys

yes = "yes"
no = "no"
experience_good = "yes"
contact = "1"

print("How many times have you bean contacted by us in the past quarter (3 months)")
contact = sys.stdin.readline()

if contact != 0:
    print("Was your experience was us good? Type a 1 for yes or 0 for no")
    experience_good = sys.stdin.readline()
    print("experiencence_good is", experience_good)
    # The above line was just to double check the variable was inputted correctly
    if experience_good is 1:
        print("Good to hear that.")
    elif experience_good is 0:
        print("Sorry about that. What could we be doing better?")
        doing_better = sys.stdin.readline()
    else:
        print("Stuff's been messed up")

The output I get is just: How many times have you bean contacted by us in the past quarter (3 months) 3 Was your experience was us good? Type a 1 for yes or 0 for no 1 exp_good is 1

Stuff's been messed up

Aucun commentaire:

Enregistrer un commentaire