这里有一点背景:我明年就要上初中了,我想为我在学校要做的事情编写一些方程式会很酷。我已经做了代数方程(在二次方程中解x等等),我认为为化学编写一些代码会很酷。我试图找出如何平衡方程式,我想我可以输入所有的量,使用某个键(比如空格),它会继续到化学方程式的下一部分。这就是我当时的想法
reac1_chem1 = input("Enter the first chemical: ")
reac1_amount1 = input("Enter the amount of " + reac1_chem1 + " atoms: )
reac1_chem2 = input("Enter the second chemical: ")
reac1_amount2 = input("Enter the amount of " + reac1_chem2 + " atoms: )
我想继续这个过程,直到空间作为化学物质进入。我如何使这个过程无限?创建变量是正确的做法还是我应该列出一个清单?如有任何建议,将不胜感激!让我知道这是否在任何方面令人困惑,我可以尝试为您澄清。谢谢
一本字典就好了:
您可以尝试将信息存储在字典字典中,示例如下:
然后,您可以访问以下信息:
然后,您可以使用一个类来存储其中的所有内容,包括函数
相关问题 更多 >
编程相关推荐