lundi 10 septembre 2018

Python Beginner- If else statement doesn't seem to work in a function

so I'm practicing with functions and I can't seem to make this if else statement run in a function. It's simplistic enough and there are no outside forces acting on it. I can get it to print out the first two but now to run the if else statement

def gendertest():
 print('Now we find out what gender you are')
 print('Do you like cars or ballerinas?')
 pref = str(sys.stdin.readline())
  if pref == 'cars':
    print('You are a girl')
    gender = girl
  elif pref == 'ballerinas':
    print('You are a boy')
    gender = boy

Aucun commentaire:

Enregistrer un commentaire