How to change a string into uppercase?

In Python, you can use the built-in upper() method to change a string to uppercase. Here's an example:

original_string = "hello world"
upper_string = original_string.upper()
print(upper_string)

This will output:

HELLO WORLD

Watch a course Python - The Practical Guide

You can also use str.upper() function to convert a string to uppercase. It is equivalent to str.upper() method on string.

original_string = "hello world"
upper_string = str.upper(original_string)
print(upper_string)

This will also output:

HELLO WORLD