|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
>>> import random
>>> times = 3
>>> secret = random.randint(1,10)
>>> guess = 0
>>> print("不妨猜一下小甲鱼现在心里想的是哪个数字:",end=" ")
>>> while(guess!=secret)and(times>0):
temp = input()
while not temp.isdigit():
temp = input("抱歉,您的输入有误,请输入一个整数:")
SyntaxError: multiple statements found while compiling a single statement
新手小白,照着小甲鱼的代码打的,不知哪里错了,前来请教一下各位大佬
本帖最后由 昨非 于 2021-3-31 20:01 编辑
多行代码还是写入文件里运行吧
shell不支持同时运行多行代码
左上角【file】点击第一个【new file】新建一个py文件
然后把你的代码复制过去,ctrl+s保存(注意会弹出文件夹窗口,要选择保存位置)
然后点击【run】->【run module】就能运行了
|
|