Learn Python

Converting a number into a string

A number can also be treated as a string by surrounding it with single quotes.

This is useful when we wish to print the number along with the string.

In this example, if the quotes are removed, an error will pop up, as we cannot print a string with an integer.

Or we could use the str function to convert a number to a string.