Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't find a proble here
#1
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
Reply
#2
correct the quote marks around avg= on line 6 (note the difference with previous lines)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(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()
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020