+ 1
Is print command useless?
It seems using quotation marks without the print keyword gives the same result of printing the text.
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
+ 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.
+ 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.
+ 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