标题: 请教报错了,关于字符串的格式化问题 [打印本页] 作者: 变色幽灵 时间: 2017-12-14 08:22 标题: 请教报错了,关于字符串的格式化问题 from random import randint
num = randint(0,100)
print 'Guess what I am thinging?'
result = int(input())
while num != %d %result:
if %d> num %result:
print 'Too big!'
print 'Guess again'
result = int(input())
if %d < num %result:
print 'Too small!'
print 'Guess again'
result = int(input())
修改的话:
1. while num != result:
2. if result> num:
3. if result < num:作者: 散不开暧昧 时间: 2017-12-14 10:49
from random import randint
num = randint(0,100)
print 'Guess what I am thinging?'
result = int(input())
while result!=num:
if result>num:
print 'Too big!'
print 'Guess again'
result = int(input())
if result<num:
print 'Too small!'
print 'Guess again'
result = int(input())
print 'Bingo!!!'