我试图创建一个阻力计算器程序,但我得到一个语法错误
print("Welcome to resistance calculator!!!")
import time
import math
time.sleep(2)
powersource=int(input("How many volts is your battery?"))
time.sleep(2)
convertquestion=input("Is your amps in milaamps?")
time.sleep(2)
if convertquestion=="yes" or "Yes":
step1=int(input("How many milaaps do you have?"))
step2=step1*.001
amps=step2
time.sleep(2)
forwardvolt=float((input("What is your forward voltage?"))
step_1=powersource-forwardvolt
step_2=step_1/amps
time.sleep(2)
print("You will need a resister value of:", step_2)
else:
firststep=int(input("How many amps do you have?"))
time.sleep(2)
secondstep=float(input("What is your forward voltage?"))
time.sleep(2)
thirdstep=powersource-secondstep
forthstep=thirdstep/firststep
print("You will need a resister value of:", forthstep)
第14行有一个额外的圆括号。改为:
相关问题 更多 >
编程相关推荐