0
What is the difference?
num="Data" mult=num*4 print(mult) #please, answer, what is the difference? print("Data"*4)
3 Réponses
+ 6
The output is the same, but in the 1st example DataDataDataData is assigned to a variable, in the 2nd it is created in print without storing it in a variable.
+ 4
Like Lisa says: using 'mult' you can re-use it later, but when you only print it, it's gone once you do it.
+ 3
For the answer, there is no difference as both 'print' are the same.
But it is better to use your 'mult' as a variable and then print it, otherwise in a longer code you will have to change every single 'print' statement, not just your variable.