Sean.D Sean.D - 4 months ago 10
Python Question

syntax error related to this code. Have tried looking it up but not helping

I am trying to create a resistance calculator program but I am getting a 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)

Answer

You've got an extra parentheses at line 14. Change it to this:

forwardvolt=float(input("What is your forward voltage?"))