There are assignments to the same variable, etc.
Check the behavior of python and memorandum using the contents that match the text
pl_pos = 1
com_pos = 1
while True:
input("enter-player moves")
pl_pos = pl_pos + random.randint(1,6)
if pl_pos>30:
pl_pos = 30
banmen()
if pl_pos ==30:
print("pl")
break
input("enter-com works")
com_pos = com_pos + random.randint(1,6)
if com_pos>30:
com_pos = 30
banmen()
if com_pos ==30:
print("com")
break
A = random.randint(1,100)
B = random.randint(1,100)
correct = A + B
ans = input("A = "+ str(A) + " B = "+str(B) +" A+What is the total of B?")
if ans == str(correct):
print("Correct answer")
else:
print("wrong" + str(correct) +"is")
[Introduction to game development made with Python](https://www.amazon.co.jp/Python%E3%81%A7%E3%81%A4%E3%81%8F%E3%82%8B-%E3 % 82% B2% E3% 83% BC% E3% 83% A0% E9% 96% 8B% E7% 99% BA-% E5% 85% A5% E9% 96% 80% E8% AC% 9B% E5% From BA% A7-% E5% BB% A3% E7% 80% AC-% E8% B1% AA / dp / 4800712394)
Recommended Posts