Python Forum

Full Version: Can't find a proble here
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
def ex10():
       mark1 = int(input("Insert math score"))
       mark2 = int(input("Insert Computer Science score"))
       mark3 = int(input("Insert physics score"))
       avg = float(mark1+mark2+mark3)/3
       print ((“avg=”,avg))
ex10()
I get erorr code, avg is not reognized
"invalid character identifier"
Please advice
correct the quote marks around avg= on line 6 (note the difference with previous lines)
(Aug-04-2019, 08:23 PM)ofir_l Wrote: [ -> ]
def ex10():
       mark1 = int(input("Insert math score"))
       mark2 = int(input("Insert Computer Science score"))
       mark3 = int(input("Insert physics score"))
       avg = float(mark1+mark2+mark3)/3
       print ((“avg=”,avg))
ex10()
I get erorr code, avg is not reognized
"invalid character identifier"
Please advice

at line 6 use " instead of “

def ex10():
       mark1 = int(input("Insert math score"))
       mark2 = int(input("Insert Computer Science score"))
       mark3 = int(input("Insert physics score"))
       avg = float(mark1+mark2+mark3)/3
       print ("avg=",avg)
ex10()