Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
34
22
211
Replies
@PythonPr Answer: Technically, nothing (no returns, doesn't even print quotes) Solution: `*` of str and int gives repetition of string. Eg, "Py" * 3 gives "PyPyPy" If the multiplication is by 0, means 0 repetitions of the str, ie, empty string. So, "Python" * 0 is "" When printed, +
1
0
11
One thing in life is certain: you’re going to die. Oddly enough, that fact can be liberating. Remembering that life has an endpoint helps you live it so that it has a point—a direction, a storyline, something more than a string of disconnected
9
15
320
Just like stepping on clouds with our Cashmere Slipper Home Socks! Perfect for chilly days around the house. Your new best friend for staying warm and stylish. Get Your Today!
0
100
1K
@PythonPr Nothing is printed, because python word is string and we are multiplying string with zero which return empty space or print("")
0
0
0
@PythonPr Omon you trying to print a str and multiplying an int without int(‘python’) I forgot the word and you expect an answer aside from system error
0
0
0
@PythonPr ANSWER is D) "" Or more practically, doesn't print anything at all, not even the empty quotes in option D
0
0
0