与此代码相关的语法错误。尝试过查找但没有帮助

时间:2016-07-08 03:09:34

标签: python syntax-error

我正在尝试创建一个阻力计算器程序但是我遇到了语法错误。

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)

1 个答案:

答案 0 :(得分:0)

您在第14行有一个额外的括号。将其更改为:

forwardvolt=float(input("What is your forward voltage?"))
相关问题