[英]I'm learning python, and I can't figure out what's wrong with this code?
正如我在标题中所说。 当我尝试运行它时,它显示以下内容。 第 30 行:SyntaxError:错误输入 (' ')
上面引用的代码如下。 我只需要在这里做一点宣传,这样我就可以发布这个了。
#Samuel Davis, module 3 exam, 12/9/19
#Declare variables
dayPay = 18.50
evePay = 20.00
nightPay = 23.50
retire = 0.02
#Prompt inputs from user
employeeShift = int(input("What shift do you work? 1=Day 2=evening 3=night."))
weekHour = int(input("How many hours did you work this week?"))
#Begin prep
if grossShift==1:
employeePay=dayPay*weekHour
elif employeeShift==2:
grossPay=evePay*weekHour
elif employeeshift==3:
grossPay=nightPay*weekHour
else:
employeePay=0
#Finalize calculations & get retirement deduction
if employeeShift==1
retireDed=0
print("You cannot get a retirement deduction in the day shift")
else
retireDed=employeePay*retire
netPay=employeepay-retireDed
print(totalPay)
您有一些语法错误/未声明的变量。 我已尽力重新构建/编辑我认为您至少要拥有一个可运行的脚本的内容:
#Declare variables
dayPay = 18.50
evePay = 20.00
nightPay = 23.50
retire = 0.02
#Prompt inputs from user
employeeShift = int(input("What shift do you work? 1=Day 2=evening 3=night."))
weekHour = int(input("How many hours did you work this week?"))
#Begin prep
if employeeShift==1:
employeePay=dayPay*weekHour
elif employeeShift==2:
grossPay=evePay*weekHour
elif employeeshift==3:
grossPay=nightPay*weekHour
else:
employeePay=0
#Finalize calculations & get retirement deduction
if employeeShift==1:
retireDed=0
print("You cannot get a retirement deduction in the day shift")
else:
retireDed=employeePay*retire
netPay=employeePay-retireDed
print(netPay)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.