所以我是一個Python的初學者,我不能找到一種方法,把輸入varible隨機像這樣,隨機使用Varibles? (蟒蛇)
import time
import random
choice = input('easy (max of 100 number), medium(max of 1000) or hard (max of 5000)? Or custom)')
time.sleep(2)
if choice == 'custom':
cus = input(' max number?')
print ('okey dokey!')
eh = 1
cuss = random.randrange(0, (cus))
easy = random.randint(0, 100)
medium = random.randint(0, 1000)
hard = random.randint (0, 5000)
if choice == 'easy' or 'medium' or 'hard' or cus:
while eh == 1:
esy = int(input('what do you think the number is?)'))
if esy > easy:
time.sleep(2)
print ('too high!')
elif esy == easy:
print (' CORRECT!')
break
elif esy < easy:
print ('TOO low')
有沒有什麼辦法可以把一個數字,有人像第9行一樣隨機鍵入?
刪除括號,並使用'(0,int(cus))' – AK47