+ 1
syntax error in print
the condition for the print is whatever we typed inside "" or ' ' will be printed or displayed but when i tried of placing a single quoted text inside a single quotes or a double quoted text inside a double quotes (i.e print(""Hello world!"")or print(''Hello world!'')) it shows an syntax error(File "..\Playground\", line 8 print(""Hello world!"") ^ SyntaxError: invalid syntax) why...
2 Respuestas
+ 7
print(""Hello world"") is invalid.
print("Hello world") is valid.
print('Hello world') is valid.
+ 1
single quote in double quote is valid, e.g. print(" ' hello world' ")
double quote in single quote is also valid, e.g. print(' "hello world" ')
using three single or double quotes is also valid, e.g. print('''hello world''') or print("""hello world""")
is this what you want to ask?