。试图查找它,但没有帮助
问题描述:
我想创建一个阻力计算器程序,但我得到一个语法错误。。试图查找它,但没有帮助
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.更改它以这样的:
forwardvolt=float(input("What is your forward voltage?"))
+0
谢谢。我没有看到额外的一个。简单的修复感谢天谢。 –
+0
因此,我对这个网站很陌生,我的程序现在可以工作,我该如何关闭这个线程,或者我只是离开它? –
+0
哦,我感觉很傻。 XD。 –
有什么语法错误? –
你得到的语法错误是什么,以及你得到的是哪一行?您可以在您面前的屏幕上获得该信息。你绝对没有理由不把它包含在你的问题中。您要求我们帮助您解决**您的问题** - 向我们提供您可用的信息,以帮助我们为您提供帮助。特别是当你不得不做任何事情,因为它在你的眼前,在你的屏幕上,它可以很容易地复制和粘贴到你的问题。 –
丢失了圆括号,你的'if'语句也是错误的。 – yurib