To write output to the screen in Python, use the print() function. The data type of the output message is always converted to the data type string. Other data types like integer or float must therefore be converted to a string by the str() or repr() function.
str() and repr() are both functions used to get a string representation of an object.
str() is used to create the output for the end user, while repr() is mainly used for debugging and development. The str() Function thus returns a user friendly string representation of an object. The repr() Function returns a developer friendly description of the object.
Source: Python Input / Output


Top comments (0)