+ 1

Is print command useless?

It seems using quotation marks without the print keyword gives the same result of printing the text.

13th Jun 2018, 5:04 PM
Kunal Tyagi
Kunal Tyagi - avatar
4 Réponses
+ 7
It won't. It will just show the same text in the interactive prompt. https://code.sololearn.com/c2ZJiR2wKDho/?ref=app
13th Jun 2018, 5:35 PM
Nikhil
Nikhil - avatar
+ 3
print() will call the object’s __str__() method. Simply typing a variable in interactive mode will call the object’s __repr__() method. They aren’t always the same. Besides, print() can be used multiple times in script mode, while the other option will (as far as I know) only work for the last variable.
13th Jun 2018, 8:28 PM
Pedro Demingos
Pedro Demingos - avatar
+ 1
Do you have an example to post here? This definitely doesn’t work for me. Print is actually a function so without it, nothing happens.
13th Jun 2018, 5:34 PM
Marco Polidori
Marco Polidori - avatar
+ 1
print is probably the most important thing in python because thats how you get an output most of the time ex. print(“hello world”) output- hello world x = 5-2 print(x) output- 3
13th Jun 2018, 5:43 PM
Nicolass22
Nicolass22 - avatar