-3
for x in range(5):
  for y in range(3):
    print(f"({x}, {y})")

I was trying to follow along in a python mastery class but I kept getting the following error.

     File "c:\Users\███\Desktop\Py Products\Tutorial\HelloWorld\app.py", line 3
    print(f"({x}, {y})")
                      ^
SyntaxError: invalid syntax
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437

1 Answers1

1

you are trying to format the string while printing so you can use

for x in range(5):
  for y in range(3):
    print('{}, {}'.format(x, y))