Post

Python Programming
Python Programming@PythonPr·
Python Quiz: Can You Predict This Python Output? 🤯
Python Programming tweet media
English
21
7
75
6.6K
Sergei Kotov
Sergei Kotov@kotov_dev·
@PythonPr Answer: 44444 int(b) converts b, but a stays a string. And str * int doesn't multiply. It repeats. '4' * 5 = '44444' For beginners: want math? Convert both. int(a) * int(b) = 20
English
2
0
15
404
Darpan
Darpan@Darpanarora0802·
@PythonPr Output is 44444. Explicit conversion means here in this we are doing manual conversion.
English
0
0
0
293
Dev Ameer
Dev Ameer@realameerdev·
@PythonPr a = 4 b = 5 C = a* ( which means repeat ) So a* Int (b) Which means repeat 4 five times. Which gives 44444
English
0
0
1
190
Louis Vuitton
Louis Vuitton@LouisVuitton·
Relive the Cruise 2027 Show by Nicolas Ghesquière.
Français
8
17
200
576K
Nelion
Nelion@NelionDev·
@PythonPr Python a = '4' b = '5' c = a * int(b) print(c) a is a string ('4') and int(b) becomes 5. In Python, multiplying a string by a number repeats the string that many times: Python '4' * 5 Output: Python 44444
English
0
0
0
34
Ankit Aggarwal
Ankit Aggarwal@TechAheadAnkit·
@PythonPr 44444 int(b) will typecast it to integer value a is string when a string is multiplied by integer it actually repeats that much times
English
0
0
0
207
Yusuke
Yusuke@Yusukeseru·
@PythonPr B (string) was rightfully converted to int, but a is still a string. So the result is an error.
English
0
0
0
20
Paylaş