나는 주사위를 굴리는 프로그램을 만들려고하고있다. 사용자가 모든 롤을 계속하기를 원한다면 프로그램을 중단해야한다. 입력 내용에 관계없이 프로그램이 루프에서 빠져 나옵니다. 누군가가 이유를 설명하고 프로그램을 만드는 데 도움이되는 몇 가지 팁을 줄 수 있습니까? 감사합니다모든 경우에 파이썬 while 루프가 깨진다.
import random
sideNumber = int(input("Enter the number of sides in the die: "))
print("Dice numbers: ")
while True:
print(random.randint(0, sideNumber))
print("Do you want to continue?")
response = input()
if response == "n" or "no":
break
응답 == '아니요'또는 응답 == '아니요'는 올바른 방법입니다. '아니오'는 항상 사실로 평가됩니다. – hashcode55