str()Easy Examples

Converts a value to a string

Basic str() usage

Simple demonstration of the str() built-in function.

python
print(str(42))
print(str(3.14))
print(str([1, 2, 3]))
print(str(True))

str() is a built-in function that converts a value to a string.

str() with different inputs

Calling str() with various argument types.

python
# More str() examples
print("str() is a Python built-in function")
print(f"Type: {type(str)}")

str() accepts different types of arguments and produces corresponding results.

Want to try these examples interactively?

Open Easy Playground