Python Forum
print(f"{person}:") SyntaxError: invalid syntax when running it
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
print(f"{person}:") SyntaxError: invalid syntax when running it
#6
(Nov-03-2020, 07:11 PM)deanhystad Wrote: Does this work?
people = ['me', 'you', 'him', 'her', 'they']
for person in people:
    print(f" {person}:")
A syntax error may have nothing to do with the line that gets flagged. It could be an error that started some line above but only became noticeable at the reported line.
Thanks for the suggestion. I was thinking that too. But unfortunately I should not modify anything else other than joint_probability , update , and normalize function.
Reply


Messages In This Thread
RE: print(f"{person}:") SyntaxError: invalid syntax when running it - by AryaIC - Nov-03-2020, 07:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Making a Class Person ? Kessie1971 3 1,248 Apr-23-2023, 05:20 PM
Last Post: deanhystad
  Invalid syntax Slome 2 2,069 May-13-2022, 08:31 PM
Last Post: Slome
  Invalid syntax error, where? tucktuck9 2 3,501 May-03-2020, 09:40 AM
Last Post: pyzyx3qwerty
  How can create class Person :( Azilkhan 1 2,028 Nov-21-2019, 08:12 AM
Last Post: DeaD_EyE
  Invalid syntax defining a dictionary? ep595 6 5,280 Nov-19-2019, 08:06 PM
Last Post: ThomasL
  Syntax Error: Invalid Syntax in a while loop sydney 1 4,163 Oct-19-2019, 01:40 AM
Last Post: jefsummers
  [split] Please help with SyntaxError: invalid syntax Mason 1 2,262 Apr-28-2019, 06:58 PM
Last Post: Yoriz
  SyntaxError: Invalid syntax in a while loop ludegrae 3 14,931 Dec-18-2018, 04:12 PM
Last Post: Larz60+
  SyntaxError: invalid syntax at run .py tuxo9999 10 7,577 Aug-23-2018, 03:58 PM
Last Post: Axel_Erfurt
  Homework: Invalid syntax using if statements chehortop 3 3,741 Mar-01-2018, 04:38 AM
Last Post: micseydel

Forum Jump:

User Panel Messages

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