用户:
活泼的重金怪gdte查看:0 回复:0 评论:0 创建时间:2021-01-24T22:32:02
【作品展示】

【作品介绍】
这里可以快速查找置换反应的反应方程式哦,快来试试吧。
【作品源代码】
import turtle
myscreen = turtle.Screen()
# 提示和输入模块
print("这里可以查找置换反应的反应方程式~")
print("请在窗口中输入参与反应的两个药品")
print("可以在控制台查看反应方程式")
A = myscreen.textinput("请输入药品1", "药品1")
B = myscreen.textinput("请输入药品2", "药品2")
# 查看模块
# 金属单质+酸=盐+氢气
if A == "锌" and B == "硫酸" or A == "硫酸" and B == "锌":
print("Zn+H2SO4===ZnSO4+H2↑")
elif A == "镁" and B == "硫酸" or A == "硫酸" and B == "镁":
print("Mg+H2SO4===MgSO4+H2↑")
elif A == "铝" and B == "硫酸" or A == "硫酸" and B == "铝":
print("2Al+3H2SO4===Al2(SO4)3+3H2↑")
elif A == "锌" and B == "盐酸" or A == "盐酸" and B == "锌":
print("Zn+2HCl===ZnCl2+H2↑")
elif A == "镁" and B == "盐酸" or A == "盐酸" and B == "镁":
print("Mg+2HCl===MgCl2+H2↑")
elif A == "铝" and B == "盐酸" or A == "盐酸" and B == "铝":
print("2Al+6HCl===2AlCl3+3H2↑")
elif A == "铁" and B == "硫酸" or A == "硫酸" and B == "铁":
print("Fe+H2SO4===FeSO4+H2↑")
elif A == "铁" and B == "盐酸" or A == "盐酸" and B == "铁":
print("Fe+2HCl===FeCl2+H2↑")
# 金属单质+盐(溶液)=另一种金属+另一种盐
elif A == "铁" and B == "硫酸铜" or A == "硫酸铜" and B == "铁":
print("Fe+CuSO4==Cu+FeSO4")
elif A == "锌" and B == "硫酸铜" or A == "硫酸铜" and B == "锌":
print("CuSO4+Zn==ZnSO4+Cu")
elif A == "铜" and B == "硝酸银" or A == "硝酸银" and B == "铜":
print("2AgNO3+Cu==Cu(NO3)2+2Ag")
# 金属氧化物+木炭或氢气→金属+二氧化碳或水
elif A == "木炭" and B == "氧化铁" or A == "氧化铁" and B == "木炭":
print("3C+2Fe2O3+高温==4Fe+3CO2↑")
elif A == "木炭" and B == "氧化铜" or A == "氧化铜" and B == "木炭":
print("C+2CuO+高温==2Cu+CO2↑")
elif A == "氢气" and B == "氧化铜" or A == "氧化铜" and B == "氢气":
print("H2+CuO△Cu+H2O")
elif A == "氢气" and B == "氧化铁" or A == "氧化铁" and B == "氢气":
print("Fe2O3+3H2==2Fe+3H2O")
# 其他
elif A == "镁" and B == "氧化铜" or A == "氧化铜" and B == "镁":
print("Mg+CuO==Cu+MgO")
elif A == "水蒸气" and B == "碳" or A == "碳" and B == "水蒸气":
print("H2O+C+高温==H2+CO")
else:
print("---------------------------")
print("不反应或不是置换反应")
print("---------------------------")
"这里可以快速查找置换反应的反应方程式哦,快来试试吧。"
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn