与此代码相关的语法错误。我试着去查,但没有帮助

2024-09-28 18:51:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图创建一个阻力计算器程序,但我得到一个语法错误

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)

Tags: importinputyourtimeisstepsleepmany