I am teaching an intro to coding class for students and we are attempting to run the following program. It is giving a syntax error. Here are both the program and error message:
# Introduction
print 'Hello. If you give me your scores, I can find your overall grade.'
ques = raw_input('Would you like me to find your class grade? y/n ')
# Get first score
if ques in ['y', 'Y', 'yes', 'Yes']:
count = 1
sum = int(raw_input('What is your first score? ')
ans = raw_input('Do you have another score for me? y/n ')
else:
ans = 'no'
print 'Thanks anyway. Run me later if you change your mind.'
# Get other scores
while ans in ['y', 'Y', 'yes', 'Yes']:
sum = sum + int(raw_input('What is the next score? ')
count = count + 1
ans = raw_input('Do you have another score for me? y/n ')
# Calculate score
avg = sum / count
print 'Your class grade is:', avg
Error message:
Last login: Wed Jun 18 10:07:31 on ttys000
D-iMac-00:~ prog$ /var/folders/1r/zxdwc24s2h5gncz_q09x46rw0000gq/T/Cleanup\ At\ Startup/fancy_grade-424798099.021.py.command ; exit;
File "/Users/prog/Desktop/Jake/fancy_grade.py", line 10
ans = raw_input('Do you have another score for me? y/n ')
^
SyntaxError: invalid syntax
logout
[Process completed]