这次试着敲一遍代码之后检查语法错误、
因为之前学过c,所以对标点符号的应用可谓慎之又慎,但还是栽在c的跟前了,习惯性地把所有的print函数敲成了printf函数,如果不是小甲鱼讲还发现不了
对了,还有明白了老程序员都在用的字体consolas
以下是代码:
"""用python设计第一个游戏"""
temp = input("不妨猜一下橙子现在心里想的是哪个数字:")
guess = int(temp)if guess == 8:
print("你是橙子心里的蛔虫吗?!")
print("哼,猜中了也没有奖励!")
else:
print("猜错啦。橙子现在心里想的是8!")print("游戏结束,不玩啦>_<")
依然保存不了,无法成功运行,看弹幕说因为是3.8.4版本,没办法用中文,所以打算改成英文试试:
3.8.4版本有问题的,目前3个解决办法:
1,用纯英文编写代码
2,不用 IDLE 用比如 PyCharm 等其他编辑器
3,不下载 3.8.4 稳定版 Python , 下载其他版本
果然!!!
"""Design the first game in Python"""
temp = input("Guess which number the orange is thinking:")
guess = int(temp)if guess == 8:
print("Are you the worm of the orange?!")
print("Hum, guess correctly also have no reward!")
else:
print("Guess wrong.The orange was thinking 8!")print("Game over. No more playing>_<")
程序成功运行!!!
= RESTART: C:/Users/Administrator/AppData/Local/Programs/Python/Python38-32/game.py
Guess which number the orange is thinking:8
Are you the worm of the orange?!
Hum, guess correctly also have no reward!
Game over. No more playing>_<
>>>
= RESTART: C:/Users/Administrator/AppData/Local/Programs/Python/Python38-32/game.py
Guess which number the orange is thinking:7
Guess wrong.The orange was thinking 8!
Game over. No more playing>_<
>>>