|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 九亿人民不答应 于 2018-1-21 18:53 编辑
[/code],
报错:invalid character in identifier
操作系统是WIN7
哪位大佬能告诉我为什么是无效字符?
代码文本:
- import random
- times = 3
- secret = random.randint(1,10)
- print('---------------我只想和你在一起----------------')
- guess = 0
- print('不妨猜一下我心里想的是哪个数字:',end=" ")
- while (guess != secret) and (times > 0):
- temp = input()
- while not temp.isdigit():
- temp = input ("抱歉,您的输入有误,请输入一个整数:")
- guess = int(temp)
- times = times - 1
- if guess == secret:
- print('你是我肚子里的蛔虫吗,这都能猜对')
- print('哼 猜中了也没有奖励。')
- else:
- if guess > secret:
- print('哥,大了大了!')
- else:
- print('嘿,小了小了!')
- if times > 0:
- print("再试一次吧:", end=" ")
- else:
- print("机会用光咯!!!")
- print('游戏结束不玩了!')
复制代码
目测你用了个中文的逗号‘,’,哈哈,
你下次发代码用帖子里的<>发,图片复制不了
|
|