Can anyone tell the logic behind this print('print("print") ') | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone tell the logic behind this print('print("print") ')

15th Apr 2016, 3:53 PM
Vipul Garg
7 Answers
+ 5
Python only recognize the first print(' everything after the first bracket will display like a string
27th Jun 2016, 8:59 AM
Blacteddy
+ 2
That statement prints the statement inside the quotes, just like a normal print statement. It will result in print("print") output to the screen.
23rd May 2016, 10:24 AM
James Flanders
+ 2
print ('print ("print ")') print (print (print(Z))) Hello Vipul, try running the above code and you will notice that any thing enclosed in quotes is treated as output, whereas if you run the same without quotes and enter a variable with some value, it will give you the value of Z. Hope that helps
29th Jun 2016, 3:32 AM
Sagar Gupta
Sagar Gupta - avatar
0
print('[any symbols, this is string]') - in this sample [any symbols, this is string] = print("print")
23rd Jun 2016, 3:29 AM
Lakhnov Sergey
Lakhnov Sergey - avatar
0
() is important that excute whole (). then ' ' mean string. so it is like that
28th Jun 2016, 5:04 PM
joon
0
Good stuff
10th Jul 2016, 1:26 PM
Chad Jam
Chad Jam - avatar
- 1
but isn't there supposed to be a backsplash before a single/double quote inside the print function?
27th Jun 2016, 6:07 AM
Pramod Krishna
Pramod Krishna - avatar