0 python syntax syntax-error while-loop python-3.x
我已经在这几个小时,搜索问题,甚至问我的兄弟,他是EE的高级,甚至他很难过.这是针对今晚午夜之前到期的项目,我似乎无法摆脱这个错误.任何人都可以看看我的代码,并弄清楚为什么我一直收到这个错误?谢谢,是的,它们在while语句下正确缩进.
# Initialize Variables
count = 0
#First Customer Input
cus = input("Enter customer's name: ")
custype = input("Enter customer's service type (R for Residential. B for Business): ")
location = input("Enter customer's service location (C for City. P for Parish): ")
kwh = eval(input("Enter customer's number of Kilowatt Hours Used: ")
#Repeat loop based on input items NOT being the sentinel value
while (count < 10):
if custype == 'R' and location1 == 'C':
rate = residentialCity
elif custype == 'R' and location1 == 'P':
rate = residentialParish
elif custype == 'B' and location1 == 'C' or 'P':
rate = business
Run Code Online (Sandbox Code Playgroud)
kwh = eval(input("Enter customer's number of Kilowatt Hours Used: ")
Run Code Online (Sandbox Code Playgroud)
算括号.
正如D.Shawley在评论中指出的那样,将用户输入传递给eval可以做任意不好的事情.你为什么eval还在那里用?
| 归档时间: |
|
| 查看次数: |
511 次 |
| 最近记录: |