for 루프의 마지막 번호 (특정 번호를 초과하는 경우)를 사용하여 while 루프에 배치하는 프로그램을 작성해야합니다. 나는 끝내지 않은 코드를 남겼다.How to get While 루프와 While 루프 사이의 통신
t=0
num=int(input("How many presents do you want to buy?: "))
for i in range(num):
t=t+int(input("Please enter the price of a present")
while t>'200':
print("Limit Exceeded.")
print("You need to get rid of the " #price from the previous loop
괄호 안의 괄호가 너무 많아 int를 문자열과 비교할 수 없습니다.'t> 200'은't> '200'보다 낫습니다. 나는 당신이이 코드로 무엇을 성취하려고하는지 이해하지 못하기 때문에 더 이상 당신을 도울 수 없습니다. – Efferalgan