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
81
19
228
25.9K
Earnest Codes
Earnest Codes@Earnesto037·
@PythonPr The output of print(a+b) will be 55. This is because the variables a and b are defined as strings due to the quotes surrounding the numbers. When you use the + operator on two strings in Python, it performs string concatenation, which means
English
1
1
17
1.3K
Omo Yewa
Omo Yewa@AceKelm·
@PythonPr The answer is B. 55. Mathematical operation cannot be performed on string data type, therefore the plus operator would concatenate the stings. So that makes the answer 55
English
0
0
8
897
Samuel Ladipo
Samuel Ladipo@ladicodez·
@PythonPr Additions of strings will lead to concatenation, so B.
English
0
0
6
172
Manish Khyalia
Manish Khyalia@Manish_Kumar60·
@PythonPr Answer:-(B)55 a and b are two strings here so when you use + operator here then python performs string concatenation.
English
0
0
2
596
Ali Atef
Ali Atef@AlyAtef_·
@PythonPr The answer is 55 😄 Because both a and b are strings, not numbers, so Python doesn’t add them , it just sticks them together. So writing "5" + "5" will print "55", same way "tea" + "cup" gives "teacup". So simple when you get it 😉
English
0
0
1
11
Debabzzy
Debabzzy@debabzzy·
@PythonPr B. This is because a "5" and b "5" are strings. So + concatenate them which gives 55
English
0
0
1
447
Yash
Yash@buildwithyash·
@PythonPr Optioj b it is string so string get added together so 55
English
0
0
1
622
Paylaş