鱼C论坛

 找回密码
 立即注册
查看: 441|回复: 3

请教一下这个代码需要怎么改啊,实在想不出

[复制链接]
发表于 2018-9-15 00:50:32 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
print("-------Make A Cup of Tea!------")
temp1 = input("Enter the tea name: ")
name = str(temp1)
print("Add", name)
temp2 = input("How hot is the water you want---80 degrees(Yes), 100 degrees(No): ")
degree = str(temp2)
temp3 = input("Cover it---Yes or No: ")
cover = str(temp3)
if degree == Yes:
    if cover == Yes:
        print(name, "with 80 degrees water and cover.")
    else:
        print(name, "with 80 degrees water.")
else:
    if cover == Yes:
        print(name, "with 100 degrees water and cover.")
    else:
        print(name, "with 100 degrees water.")



流程图我已经发出来了,谢谢指导
Make A Cup of Tea - ProcessOn - Google Chrome 2018_9_13 16_55_19.png
Make A Cup of Tea - ProcessOn - Google Chrome 2018_9_13 16_55_31.png
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2018-9-15 02:37:33 | 显示全部楼层
print("-------Make A Cup of Tea!------")
temp1 = input("Enter the tea name: ")
name = str(temp1)
print("Add", name)
temp2 = input("How hot is the water you want---80 degrees(Yes), 100 degrees(No): ")
degree = str(temp2)
temp3 = input("Cover it---Yes or No: ")
cover = str(temp3)
if degree == "Yes":
    if cover == "Yes":
        print(name, "with 80 degrees water and cover.")
    else:
        print(name, "with 80 degrees water.")
else:
    if cover == "Yes":
        print(name, "with 100 degrees water and cover.")
    else:
        print(name, "with 100 degrees water.")
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-9-15 02:39:47 | 显示全部楼层
if 语句中的yes或no都应加上双引号,因为是字符串
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-9-15 04:22:58 | 显示全部楼层
哦哦,懂了,谢谢!
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-10-7 04:31

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表