+ 6
What's the difference between print ("5")and print (5)
Does it change anything or its the same
9 Respostas
+ 9
Technically nothing.
print automatically converts non-strings to strings before printing them.
print("5") #5 is already string.
print(5) #Program converted 5 to string.
This can be proved with OOP by creating objects with either of these 2 magic methods: __str__ and __repr__.
It will be called like any other function, when you print the object.
+ 4
5 is a integer whereas "5" Is a string literal as it can be identified by double inverted commas, but the answer will be same though
+ 3
("5") prints a string while (5) prints an integer, can matter if dealing with operations.
+ 3
Thanks guys!!
+ 2
Print("5") is for a string and print(5) is a number such that you can do operation like 5+5 =10 ,
+ 2
Print("5") // means you are printing a string
print (5) // means you are printing an integer
+ 2
Only the data type.