0
n = int(input())
for i in range(1,11):    
    m  = n*i
    print(f"{n} * {i} = {m}")

I am trying to run this code but I am getting the error message below.

  File "main.py", line 4                                                                                                                
    print(f"{n} * {i} = {m}")                                                                                                           
                           ^                                                                                                            
SyntaxError: invalid syntax                                                                                                             
                                                                                                                                        
                                                                                                                                        
...Program finished with exit code 1                                                                                                    
Press ENTER to exit console.  

I am using online compiler - onlinegdb python

1 Answers1

2

The following will reveal the used Python version:

import sys

print(sys.version_info)

If you run this, the output in https://www.onlinegdb.com/online_python_compiler is:

sys.version_info(major=3, minor=4, micro=3, releaselevel='final', serial=0) 

This is Python Version 3.4.3. F-strings are only a Python feature since 3.6, so no surprise there.

user2390182
  • 72,016
  • 6
  • 67
  • 89