繁体   English   中英

我有一个“bad token”错误,谁能告诉我为什么? (代码)

[英]I have a “bad token” error can anybody tell me why? (codehs)

Ideal= int(input("What grade do you want on your next assignment?"))

Current= int(input("What is your current grade in the class?"))
weight = int (input("What is the weight of the assignment (how much of your grade is it worth)?"))
print Ideal

print Current

print weight

Final_grade = Ideal − (( 1 − weight ) * Current)* weight

print "You will need to get a" , Final_grade , "on your next assignment to recieve a" , Current , "in this class"

错误是因为您的字符实际上不是减号字符。 您可能从实际上没有减号的地方复制了这段代码。

这是正确的减号: -

尝试这个:

Ideal= int(input("What grade do you want on your next assignment?"))

Current= int(input("What is your current grade in the class?"))
weight = int (input("What is the weight of the assignment (how much of your grade is it worth)?"))
print Ideal

print Current

print weight

Final_grade = Ideal - (( 1 - weight ) * Current)* weight

print "You will need to get a" , Final_grade , "on your next assignment to recieve a" , Current , "in this class"

Output:

What grade do you want on your next assignment?5
What is your current grade in the class?4
What is the weight of the assignment (how much of your grade is it worth)?4
5
4
4
You will need to get a 53 on your next assignment to recieve a 4 in this class

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM