Python Forum

Full Version: calculating and accumulating scores
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to accumulate the numbers from the question and then print a reply based on whether the total is above or below 7, but I keep getting syntax errors. Any ideas? I need to have a float, loop, one operator symbol (+,-,*) an accumulation pattern,and a conditional statement comparing numbers.



score=0
questions = ['How long can your assignment wait until its done?', 'How good are the conditions?','Will you have time to study after you ski?']

#rate each question on a scale of 1-5
for question in questions:
  rating=float(input(question))
score += rating

if score is >= 7:
  print("")
elif rating is (<=7):
  print("")
else:
  print("")

#calculate the weighted average score 


#If score is 7 or above, print you should study, if score is below 7, pring you should ski
Please use python tags in your post for the code. Otherwise the indentation is difficult to see.

is is a type of python comparison and > (and similar) is a type of comparison. You don't use them together, so is > will not make sense. Fix that (and the odd parentheses on the elif line) and you should be a lot closer.
Line 7 needs to be indented to be inside the loop
Put something inside the quotes on your print statements so you can see the result
Your if comparison in line 9 compares (once you fix as above) score with 7. The elif compares rating with 7 (once you again fix). I don't think you mean that.