Course Content

Data Types in Python

## Data Types in Python

# 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:

`value = "123" new_value = value + 10 print(new_value)`

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:

`value = "123" new_value = int(value) + 10 print(new_value)`

Task

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**.

**Increase**`price1`

by`15`

.**Increase**`price2`

by`780`

.**Decrease**`price3`

by`90`

.- Print the corrected variables.

Thanks for your feedback!

# 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:

`value = "123" new_value = value + 10 print(new_value)`

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:

`value = "123" new_value = int(value) + 10 print(new_value)`

Task

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**.

**Increase**`price1`

by`15`

.**Increase**`price2`

by`780`

.**Decrease**`price3`

by`90`

.- Print the corrected variables.

Thanks for your feedback!

# 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:

`value = "123" new_value = value + 10 print(new_value)`

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:

`value = "123" new_value = int(value) + 10 print(new_value)`

Task

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**.

**Increase**`price1`

by`15`

.**Increase**`price2`

by`780`

.**Decrease**`price3`

by`90`

.- Print the corrected variables.

Thanks for your feedback!

`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:

`value = "123" new_value = value + 10 print(new_value)`

**concatenation can be applied only to strings**).

**transform the string into an integer** using `int()`

function:

`value = "123" new_value = int(value) + 10 print(new_value)`

Task

**string data type**.

**Increase**`price1`

by`15`

.**Increase**`price2`

by`780`

.**Decrease**`price3`

by`90`

.- Print the corrected variables.