【发布时间】:2017-05-09 01:10:35
【问题描述】:
如果您能帮助我解决此代码中的问题,我将不胜感激。
- while 循环不起作用
- 当程序要求计算时,它会停止
总体思路是让这个小程序在计算的时候帮助我,如果可能的话,加个可视化界面。
def cycle():
while True:
newcalc = input('Do you want to make a new calculation? \n \t (Y/N)')
if newcalc.lower() in ["no","n"]:
newcalc = "no"
break
if newcalc.lower() in ["yes","y"]:
newcalc = "yes"
else:
print('This is not the right answer')
def counting_M():
while True:
concersion_1 = input('Do you want to convert from M to uM? (Y/N)')
if concersion_1.lower() in ["y", "yes"]:
print('This is the result of the conversion {} uM', str(data/1000)).format(data)
mw = input('What is the Molecular Weight of your compound, please in g/M?')
print('Your coumpound weights ug/ml', str((data) / (mw / 1000))).format(data)
if mw in float:
print('The data you have entered is not numeric')
break
data = input('Please, provide the absolute amount of compound you have, without units \n \t')
units = input('Please, indicate the measure unit you have \n A)M, B)mM, C)uM '
'\n 1A)g/liter, 2A)mg/ml, 3A)ug/ml \n \t')
if units.lower() == "a" :
print('Ok so you have M')
counting_M()
cycle()
谢谢
【问题讨论】:
-
什么是
units?mw_calc是什么?请修正缩进。至少有两个地方是错误的。
标签: python-3.x loops decision-tree solver