python中为什么不能在判断的时候进行变量初始化操作
#-*-coding:utf-8-*-fromrandomimportrandintnum=randint(1,100)print"GuesswhatIthink?"wh...
# -*- coding:utf-8 -*-
from random import randint
num = randint(1,100)
print "Guess what I think?"
while (answer=input())!=num:
if answer<num:
print "%d is too small" % answer
if answer>num:
print "%d is too big" % answer
if answer==num:
print "BINGO,%d is right answer" % answer
bingo = True 展开
from random import randint
num = randint(1,100)
print "Guess what I think?"
while (answer=input())!=num:
if answer<num:
print "%d is too small" % answer
if answer>num:
print "%d is too big" % answer
if answer==num:
print "BINGO,%d is right answer" % answer
bingo = True 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询