Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Converting: str() | Reuniendo Todos los Temas
Tipos de Datos en Python
course content

Contenido del Curso

Tipos de Datos en Python

Tipos de Datos en Python

1. Familiarizándonos con los Números en Python
2. ¿Verdadero o Falso?
3. Strings
4. Reuniendo Todos los Temas

book
Converting: str()

Let's talk about strings!

As you remember, the following text leads to an error:

1
print("My age is" + 20)
copy

To implement concatenation here, we can just put 20 in quotes, like "20", but this solution doesn't look beautiful program-wise.

Hence, your work will be more fruitful if we can convert everything into strings. Here, the str() function should be implemented:

1
print("My age is " + str(20))
copy

Note

The syntax of this operation may appear familiar, resembling that of the int() or float() functions. In reality, it is identical, as it involves converting an argument into a string using the str() function.

Tarea
test

Swipe to begin your solution

You've already made it through a lot of chapters, way to go!

Your task here is to correct mistakes to make the program execute. Convert numbers to the str data type to manage the task.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 5
toggle bottom row

book
Converting: str()

Let's talk about strings!

As you remember, the following text leads to an error:

1
print("My age is" + 20)
copy

To implement concatenation here, we can just put 20 in quotes, like "20", but this solution doesn't look beautiful program-wise.

Hence, your work will be more fruitful if we can convert everything into strings. Here, the str() function should be implemented:

1
print("My age is " + str(20))
copy

Note

The syntax of this operation may appear familiar, resembling that of the int() or float() functions. In reality, it is identical, as it involves converting an argument into a string using the str() function.

Tarea
test

Swipe to begin your solution

You've already made it through a lot of chapters, way to go!

Your task here is to correct mistakes to make the program execute. Convert numbers to the str data type to manage the task.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 5
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt