lowellbrooks711 lowellbrooks711
  • 29-04-2022
  • Computers and Technology
contestada

If the following code is executed, what is the output? a = 1 b = 2. c = '3' d = (1, 2., '3') e = [4, 5., '6'] print type(b+c)

Respuesta :

gift1723
gift1723 gift1723
  • 29-04-2022

Answer:

TypeError

Explanation:

b = 2

c = '3'

- b is of type integer because it is storing an Integer.

- c is of type string, since '3' is a string.

Since they are of different types, you can't add/ concatenate them. To add them you would need to change the string ('3') to an integer to get 5. Or you would need to convert 3 into a string to get '32' or '23'.

Answer Link

Otras preguntas

Hey guys, I need 5 sentences!¿Prefieres viajar en coche, en tren, en barco o en avión? ¿Por qué?
how do you balance __H2SO4 + __B(OH)3 --> __B2(SO4)3 + __H2O
how do you balance __H2SO4 + __B(OH)3 --> __B2(SO4)3 + __H2O
Hey guys, I need 5 sentences!¿Prefieres viajar en coche, en tren, en barco o en avión? ¿Por qué?
Hey guys, I need 5 sentences!¿Prefieres viajar en coche, en tren, en barco o en avión? ¿Por qué?
Hey guys, I need 5 sentences!¿Prefieres viajar en coche, en tren, en barco o en avión? ¿Por qué?
how do you balance __H2SO4 + __B(OH)3 --> __B2(SO4)3 + __H2O
Hey guys, I need 5 sentences!¿Prefieres viajar en coche, en tren, en barco o en avión? ¿Por qué?
how do you balance __H2SO4 + __B(OH)3 --> __B2(SO4)3 + __H2O
how do you balance __H2SO4 + __B(OH)3 --> __B2(SO4)3 + __H2O