0
"" or ''
Do we use " " or ' ' inside the parenthesis to print the statement ?
3 odpowiedzi
+ 4
You are free to use either single or double quotes for printing a string, just remember not to wrap numbers with quotes; don't wrap with quotes if you want to print numbers, as expression or as arithmetic calculation. And there's no need to wrap variable name with quotes either;
print("This is a string")
print('This is also a string')
# printing arithmetic calculation
print(2 * 21) # output: 42
magic_number = 42
# printing variable value
print(magic_number) # output: 42
+ 3
Whichever you like! Just start and close with the same one. We have this choice so we can use quotation marks inside our string, like
print('She said, "Hello, Solo!"')
Output: She said, "Hello, Solo!"
(Although there are other ways to achieve this.)
+ 2