Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Useful Converting | 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
Useful Converting

The int() function can be useful if you're working with numerical data. For instance, imagine that we have a lot of numbers that need to be modified, but all of them have a string data type. This code leads to an error:

1234
value = "123" new_value = value + 10 print(new_value)
copy

Here, Python tries to concatenate the strings, but indeed its functionality doesn't allow it to do so, since 10 is related to the integer data type (concatenation can be applied only to strings).

To correctly sum these numbers, you should initially transform the string into an integer using int() function:

1234
value = "123" new_value = int(value) + 10 print(new_value)
copy
Tarea
test

Swipe to begin your solution

Hence, your objective in this context is to address this issue. Consider a scenario where you have three price values, but an individual lacks the proficiency to manipulate data in a numerical format. Consequently, you are required to handle prices associated with the string data type.

  1. Increase price1 by 15 and store the result in new_price1
  2. Increase price2 by 780 and store the result in new_price2
  3. Decrease price3 by 90 and store the result in new_price3

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 2
toggle bottom row

book
Useful Converting

The int() function can be useful if you're working with numerical data. For instance, imagine that we have a lot of numbers that need to be modified, but all of them have a string data type. This code leads to an error:

1234
value = "123" new_value = value + 10 print(new_value)
copy

Here, Python tries to concatenate the strings, but indeed its functionality doesn't allow it to do so, since 10 is related to the integer data type (concatenation can be applied only to strings).

To correctly sum these numbers, you should initially transform the string into an integer using int() function:

1234
value = "123" new_value = int(value) + 10 print(new_value)
copy
Tarea
test

Swipe to begin your solution

Hence, your objective in this context is to address this issue. Consider a scenario where you have three price values, but an individual lacks the proficiency to manipulate data in a numerical format. Consequently, you are required to handle prices associated with the string data type.

  1. Increase price1 by 15 and store the result in new_price1
  2. Increase price2 by 780 and store the result in new_price2
  3. Decrease price3 by 90 and store the result in new_price3

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 2
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