[英]Using If, elif, else, using formulas instead of print statements
Someone in Stackoverflow answered my question which was brilliant, I need to replace the print statements with formulas. Stackoverflow中的某人回答了我的这个很棒的问题,我需要用公式替换print语句。
The reason for this so I can convert the output to hours, minutes, seconds. 这样做的原因是,我可以将输出转换为小时,分钟,秒。
Having multiple print statements and the formula included I can not separate them. 具有多个打印语句和包含的公式,我无法将它们分开。
I have three logics but just need to separate them into formulas like the print statement. 我有三种逻辑,但只需要将它们分成类似于print语句的公式即可。
Original program: 原始程序:
T17 = input('?')
if T17 < 0:
print("LOCAL SIDEREAL TIME",T17 + 24)
elif T17 > 24:
print("LOCAL SIDEREAL TIME",T17 - 24)
else:
print("LOCAL SIDEREAL TIME",T17)
This is what I am trying to do. 这就是我想要做的。
T17 = input('?')
if T17 < 0:
T17 + 24
elif T17 > 24:
T17 - 24
else:
print("LOCAL SIDEREAL TIME",T17)
It seems as though you meant to re-assign the calculations back to T17
: 似乎您打算将计算重新分配回
T17
:
T17 = input('?')
if T17 < 0:
T17 = T17 + 24
elif T17 > 24:
T17 = T17 - 24
print("LOCAL SIDEREAL TIME", T17)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.