用户:
梦想de星辰查看:0 回复:0 评论:0 创建时间:2022-12-17T20:41:59
【作品展示】

【作品介绍】
一个小学生的第一个Phython作品希望大家多多支持
(还没有完成哦~)
【作品源代码】
import easygui
import time
easygui.msgbox('温馨提示:等待时不要按回车 输入时输入数字即可(输入钱数时可以输入小数)')
print('放学了,你带了一些钱,准备坐车回家')
money = float(input('你有多少钱?'))
while (money >= 300):
money = float(input('请输入一个合理的数字'))
if (money >= 10):
print('你带的钱比较多,你准备打车回家')
money -= 10
print('你还剩', money, '元')
elif (money <= 9.9 and money >= 2):
print('你带的钱比较少,你准备坐公交车回家')
money -= 2
print('你还剩', money, '元')
else:
print('你的钱不够坐车,你只好走路回家了')
time.sleep(1.5)
print('......')
time.sleep(1.5)
print('你到了小区门口,门口有个面包店和便利店。')
answer1 = int(input('你要去哪一家店? 1.面包店 2.便利店 3.直接回家'))
if (answer1 == 1):
print('你进了面包店')
time.sleep(1.5)
print('面包店里有5种面包:1.甜甜圈:5元 2.小汉堡:6元 3.小盒寿司:5.5元 4.小蛋糕:4.5元 5.大盒寿司:7元')
answer2 = int(input('你要买哪种面包?'))
if (answer2 == 1):
if (money >= 5):
money -= 5
print('你买了一个甜甜圈来吃')
print('你还剩', money, '元')
else:
print('你看了看剩下的钱,好像不够')
if (money >= 4.5 and money <= 4.9):
time.sleep(1)
answer3 = int(input('你还要继续逛吗? 1.继续 2.回家'))
if (answer3 == 1):
answer4 = int(input('你只能买小蛋糕了,你要买吗? 1.买 2.不买'))
if (answer4 == 1):
print('你买了一袋小蛋糕来吃')
money -= 4.5
print('你还剩', money, '元')
time.sleep(1.5)
print('你决定回家了')
time.sleep(1.5)
print('......')
else:
print('你决定回家了')
if (answer2 == 2):
if (money >= 6):
money -= 6
print('你买了一个小汉堡来吃')
print('你还剩', money, '元')
elif (money >= 5 and money <= 5.9):
answer5 = int(input('你还要继续逛吗? 1.继续 2.回家'))
if (answer5 == 1):
answer6 = int(input('你只能买小蛋糕或者小盒寿司了,你要买吗? 1.买 2.不买'))
if (answer6 == 1):
answer7 = int(input('你要买小蛋糕还是小盒寿司? 1.小蛋糕 2.小盒寿司'))
if (answer7 == 1):
print('你买了一袋小蛋糕来吃')
money -= 4.5
print('你还剩', money, '元')
time.sleep(1.5)
print('你决定回家了')
time.sleep(1.5)
print('......')
else:
print('你买了一小盒寿司来吃')
money -= 5.5
print('你还剩', money, '元')
time.sleep(1.5)
print('你决定回家了')
time.sleep(1.5)
print('......')
else:
print('你决定回家了')
time.sleep(1.5)
print('......')
else:
print('你决定回家了')
time.sleep(1.5)
print('......')
print('你看了看剩下的钱,好像不够')
time.sleep(1)
else:
print('你看了看剩下的钱,好像不够')
time.sleep(1.5)
print('你看了看,好像什么都买不了了')
time.sleep(1.5)
print('你还是决定回家了')
if (answer2 == 3):
if (money >= 5):
print('你买了一小盒寿司来吃')
money -= 5.5
time.sleep(1.5)
print('你还剩', money, '元')
time.sleep(1.5)
print('你准备回家了')
time.sleep(1.5)
print('......')
elif (money >= 4.5 and money <= 4.9):
print('你看了看剩下的钱,好像不够')
time.sleep(1.5)
answer8 = int(input('你还要继续逛吗? 1.要 2.不要'))
if (answer8 == 1):
answer9 = int(input('你只能买小蛋糕了,你要买吗? 1.要 2.不要'))
if (answer9 == 1):
print('你买了一袋小蛋糕来吃')
money -= 4.5
print('你还剩', money, '元')
time.sleep(1.5)
print('你决定回家了')
time.sleep(1.5)
print('......')
else:
print('你决定回家了')
time.sleep(1.5)
print('......')
else:
print('你看了看剩下的钱,好像不够')
time.sleep(1.5)
print('你看了看,好像什么都买不了了')
time.sleep(1.5)
print('你准备回家了')
time.sleep(1.5)
print('......')
if (answer2 == 4):
if (money >= 4.5):
money -= 4.5
print('你买了一袋小蛋糕来吃')
print('你还剩', money, '元')
time.sleep(1.5)
print('......')
time.sleep(1.5)
print('你决定回家了')
time.sleep(1.5)
print('......')
else:
print('你看了看剩下的钱,好像不够')
time.sleep(1.5)
print('你看了看,好像什么都买不了了')
time.sleep(1.5)
print('你决定回家了')
if (answer2 == 5):
if (money >= 7):
money -= 7
print('你还剩', money, '元')
time.sleep(1.5)
print('......')
time.sleep(1.5)
print('你决定回家了')
elif (money >= 4.5 and money <= 6.9):
print('你看了看剩下的钱,好像不够')
time.sleep(1.5)
answer10 = int(input('你还要继续逛吗? 1.要 2.不要'))
if (answer10 == 1):
answer11 = int(input('你只能买其它的了,你要买吗? 1.要 2.不要'))
if (answer11 == 1):
answer12 = int(input('你要买什么? 1.甜甜圈 2.小汉堡 3.小盒寿司 4.小蛋糕'))
if (answer12 == 1):
money -= 5
print('你买了一个甜甜圈来吃')
print('你还剩', money, '元')
else:
print('你决定回家了')
time.sleep(1.5)
print('......')
else:
pass
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn