這是我的代碼,我想它要經過,並選擇它適合於哪一類,但它總是給我F.爲什麼我的if語句在這個分級代碼中不起作用?
import random
def rand(start, stop):
print random.randint(start,stop)
def grader(rand):
print "Your test score is "
x = rand(50, 100)
if x >= 90:
print "which is an A."
elif x <= 89 and x >= 80:
print "which is a B."
elif x <= 79 and x >= 70:
print "which is a C."
elif x <= 69 and x >=60:
print "which is a D."
else:
print "which is a F."
'print'不是'return'。 – user2357112
爲什麼你需要和random.randint()完全相同的函數? – Barmar
我的老師讓我把它放在:/ – Hat