dimanche 9 août 2015

Python If-elif statement

Quick question, I'm working on a program that takes a number from a user and uses an algorithm to try to beat their score. Anyways, when they pick a number from the list it should store it into the humanint variable, however when I do elif the terminal just closes past the input of the number. any ideas?

numbers = 16, 9, 12, -14, -9, -10
print (numbers)
humanint = input("What number will you place your piece on?")
print ("Player 1 (Black) selects " + humanint + "!")
print("(*) Denotes terminal value (sum)")

if (humanint == 16):
    mmtree = '[{A:16} [{B:9} [{*G:25}]] [{C:12} [{*H:28}]] [{D:-14} [{*I:2}]] [{E:-9} [{*J:7}]] [{F:9} [{*K:6}]] ]'
elif (humanint == 9):
    mmtree = '[{A:9} [{B:16} [{*G:25}]] [{C:12} [{*H:21}]] [{D:-14} [{*I:-5}]] [{E:-9} [{*J:0}]] [{F:-10} [{*K:-1}]] ]'
elif (humanint == 12):
    mmtree = '[{A:12} [{B:16} [{*G:28}]] [{C:9} [{*H:21}]] [{D:-14} [{*I:-2}]] [{E:-9} [{*J:3}]] [{F:-10} [{*K:2}]] ]'
elif (humanint == -14):
    mmtree = '[{A:-14} [{B:16} [{*G:2}]] [{C:9} [{*H:-5}]] [{D:12} [{*I:-2}]] [{E:-9} [{*J:-23}]] [{F:-10} [{*K:-24}]] ]'
elif (humanint == -9):
    mmtree = '[{A:-9} [{B:16} [{*G:7}]] [{C:9} [{*H:0}]] [{D:12} [{*I:3}]] [{E:-14} [{*J:-23}]] [{F:-10} [{*K:-19}]] ]'
elif (humanint == -10):
    mmtree = '[{A:-10} [{B:16} [{*G:6}]] [{C:9} [{*H:1}]] [{D:12} [{*I:2}]] [{E:-14} [{*J:-24}]] [{F:-9} [{*K:-19}]] ]'

Aucun commentaire:

Enregistrer un commentaire