Python Forum
Probably easiest question ever - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Probably easiest question ever (/thread-40267.html)



Probably easiest question ever - VINCENZOOO - Jul-01-2023

Just started coding for the first time with python. Trying to understand why I cannot write ''Hello World'' but can write 'Hello World'? It seems to cause me problems down the road when I write more lines

print(''Hello world'')
^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?

This problem comes up, must be the easiest solution to this.

Thanks in advance already.


RE: Probably easiest question ever - deanhystad - Jul-01-2023

You saw an example that used double quotes around a string and you thought it was two single quote characters. It is not. It is a single character. Two single quotes with no space between is an empty string. Python thought you wanted to print an empty string followed by something else. It complained that there was not a comma between the two.

You can do this.
print('Hello world')
Or you can do this, using the double quotes character.
print("Hello world")