Post

Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
39
9
107
17.7K
Sergei Kotov
Sergei Kotov@kotov_dev·
@PythonPr Answer: A) hellohellohello For beginners: › "hello" * 3 = "hellohellohello" › "ab" * 2 = "abab" › "-" * 10 = "----------" String multiplication repeats it! Super useful for creating separators, paddings, or patterns. Works with any string and positive integer.
English
0
0
7
499
ANKIT 𓃱
ANKIT 𓃱@A9kitSingh·
@PythonPr Answer: A) hellohellohello In Python, multiplying a string by an integer repeats the string that many times. So "hello" * 3 concatenates "hello" three times, resulting in hellohellohello.
English
1
0
4
1.3K
Arn
Arn@duskcryptic·
@PythonPr A String * 3 means number of times string repeats itself
English
0
0
1
1K
laso
laso@lasitolas·
@PythonPr Should be hellohellohello. None of those options are correct
English
0
0
1
225
Adam Wang
Adam Wang@adamydwang·
@PythonPr no right answer. I think it should be hellohellohello
English
0
0
0
6
Mazoleno Dutra | Ciência Acessível
@PythonPr Yo Python fam! Let's break this down The code is: Copiarx = "hello" print(x * 3) So, what's the output? If you guessed A: hellohellohello – you're absolutely right! Why? In Python, multiplying a string by an integer repeats the string that many times.
English
1
0
0
2
Ehshanulla
Ehshanulla@Ehshanulla·
@PythonPr x is a string multiply a string by an integer repeats the string so the output= hellohellohello
English
0
0
0
401
Lupacy Dan
Lupacy Dan@d_lupacy·
@PythonPr To me there's no answer cause choice A is close to it
English
0
0
0
8
Karathanasis Athanasios
Karathanasis Athanasios@k_athanasi·
@PythonPr hellohellohello is the correct The option A may be but it is mispelled so not sure None of the options given ?
English
0
0
0
12
Jak Darmes
Jak Darmes@DarmesJak·
@PythonPr A because multiplying a string with and integer multiplies string in as many times
English
0
0
0
8
LinusCheung
LinusCheung@LinusCheung1912·
@PythonPr Selecting any of the above four opinions is incorrect. If you mast choose one, only A is acceptable, but the output is incomplete!
English
0
0
0
664
Paylaş