我做了這個代碼,我希望它告訴我,它使用多少次發現我放在號碼,我想告訴它應該有多少次repite找到「stop_at」如何計算python中條件語句的輸出?
print 'first write the random int (lowest number first)'
imp1 = float(raw_input())
imp2 = float(raw_input())
print 'the prosess will be between', imp1, 'and', imp2, 'when do you want to stop the opperation'
stop_at = float(raw_input())
while True:
num = random.randint(imp1, imp2)
if num == stop_at:
print
print
print stop_at, "were found after", ..., 'tryes'
print ' '
break
print num
的作用
op詢問在stop_at之前重複動作的次數。找到at_stop時循環會中斷,匹配stop_at匹配的次數總是返回1 – SuperRafek