Kann nicht konvertieren 'tuple' object to str implizit

a=int(input("please input number of players  "))
while (a < 2):
a=int(input("please input at least two players  "))
if (a==2):
p1=input("please enter name for player 1  ")
p2=input("please enter name for player 2  ")
x=float(input("please enter initiative for "+(p1)))
y=float(input("please enter initiative for "+(p2)))
x=x,p1
y=y,p2
if (x > y):
    lowest=y
    highest=x
elif(y > x):
    lowest=x
    highest=y
print(lowest)
steps=int(input("Please enter number of steps for "+(lowest)+" action" ))

ich habe versucht, alles, was ich denken kann, und es muss dies tun, aber ich kann nicht herausfinden, wie es funktioniert

  • Können Sie das klären, ist die Frage? Wo sind Sie konkret ein problem?
  • Während für andere Sprachen posting unindented code ist nur die schlechte Angewohnheit, für Python macht den code unmöglich zu testen; Update Einzug.
  • lowest, highest = sorted((x, y)) spart 5 Linien, und verhindert den Absturz, wenn x==y
InformationsquelleAutor sorcererq | 2014-05-06
Schreibe einen Kommentar