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
33
4
123
12.9K
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@PythonPr The correct answer is d) TypeError. Explanation: a is a float (1.0) b is a string ("2") Python does not allow adding a float and a string directly using + So print(a + b) raises a TypeError because the operand types are incompatible.
English
0
0
16
888
Saylimunde
Saylimunde@Saylimunde1·
@PythonPr In python you can not add float and string Together...because python dynamic type language so option D is the correct answer
English
0
0
2
386
Omo Yewa
Omo Yewa@AceKelm·
@PythonPr It's going to raise a type error. Therefore the answer is D. If a was an integer type, the answer would have been 12 because the plus sign in the print block would have concatenated a and b.
English
0
0
2
344
Jimmy Fikes
Jimmy Fikes@akajim·
@PythonPr TypeError. Strings and floats cannot be concatenated.
English
0
0
1
202
Kode.org
Kode.org@TOmuabor·
@PythonPr It error. Adding a string with a float
English
0
0
0
317
Uday Sharma
Uday Sharma@udaysharmatech·
@PythonPr TypeError. Python won’t add a float and a string just to be polite.
English
0
0
0
154
Voluxx
Voluxx@voluxx1·
@PythonPr Type error, can't add different data types!
English
0
0
0
4
Thabo Ndlovu
Thabo Ndlovu@Tboss44_2·
@PythonPr d. TypeError, Floats and Strings cannot be concatenated.
English
0
0
0
3
Sir Nd
Sir Nd@Nnamdi_aqua·
@PythonPr D. String and float numbers cannot be added together.
English
0
0
0
271
LucasH Sketch
LucasH Sketch@dibujoslucas·
@PythonPr Eso es TypeError de cabeza. Sumar float con string, clásico error de manual, Python ni lo intenta.
Español
0
0
0
253
แชร์