【randint】...2.5与python3.2有什么区别importrandomsecret=random.randint(...

发布时间:2021-03-20 02:21:31

python2.5与python3.2有什么区别import randomsecret = random.randint(1,100)guess = 0tries = 0print (ahoy!I'm the dread pirate,and i have a secret!)print (it is a number from 1to 99.i'11 give you 6 tries.)while guess =secret and tries secret:print (too high,landlubber!) tries = tries + 1 if guess == secret:print (avast!ye got it!gound my secret,ye did!) else:print (no more guesses!butter luck next time,matey!) print (the secret numbei wad),secret 这个在3.2里怎么运行不了

网友回答

【答案】 guess = 20, input(what's yer guess?)
  这里是相当于把一个 tuple 赋给 guess
  所以执行if guess
以上问题属网友观点,不代表本站立场,仅供参考!