I am working together on Python code with another beginning coder. Now we both have Python 3.8.2 installed. He is working on MAC and I am working on windows. We both work from Visual Studio Code and have the same Python extension installed (v 2020.3.71113 (31 March 2020) ).
The problem occurs when I define the type of parameters, such as in the following code:
def printing(name: str):
print("This is your name: " + name)
printing("Mike")
On my computer this simply returns:
This is your name: Mike
, as I would expect.
But on his computer it throws a SyntaxError:
File ""File location"", line 1
def printing(name: str):
^
SyntaxError: invalid syntax
Now when we change the function to def printing(name):
and leave all the rest unchanged, the error does not occur.
Any ideas why this happens and how we can let his computer work with defined types of parameters?