Difference between str and repr in Python

Both of these convert objects to their string representations:

Difference between str and repr in Python
Difference between str and repr in Python

repr: This produces results that look as though they were code. repr method for extra details.
str: str converts to a typically more user-friendly format if available. str is for general user.

str function converts a number to its string representation. repr function also converts an object to its string representation, but returns the object as a string of code that can be rerun to recreate the object.