Home Browser Contributors

String (str)

A String is a type of value used in Python. A string is used to represent text. The String type is referred to as str internally in Python. Strings are different from other types because they always either have double or single quotes around them.

Example

Here is an example of a string:

``` py "Hello World" ```

You can also convert another value to a string with our example value being a integer of 5:

``` py str(5) ```

You can also use type conversion in function parameters, this example is with print() showing the output of a integer variable:

``` py import random randNum = random.randint(1, 5) print(f"You're number is... {str(randNum)}") ```