Working with Input in Python
|
|
| Working with Input in Python |
Let's assume we want to take the age of the user as input. We know that the input() function returns a string. To convert it to a number, we can use the int() function:
RUNSimilarly, in order to convert a number to a string, the str() function is used. This can be useful if you need to use a number in string concatenation.
For example: RUNYou can convert to float using the float() function.