We can use the inbuilt function str() to convert a number into a string. If you want an octal or hexadecimal representation, we can use the oct() or hex() inbuilt function.
In Python, you can convert a number to a string using the str()
function. Here’s an example:
python
number = 123
number_as_string = str(number)
print(number_as_string) # Output: '123'
This function converts the given number to its string representation.