How to change a string into uppercase?
In Python, you can use the built-in upper() method to change a string to uppercase.
In Python, you can use the built-in upper() method to change a string to uppercase. Here's an example:
Change a string into uppercase in Python
original_string = "hello world"
upper_string = original_string.upper()
print(upper_string)This will output:
HELLO WORLDYou can also call the upper() method directly on the str class. While this works, using the instance method s.upper() is the standard and more readable Pythonic approach.
Change a string into uppercase in Python using str.upper
original_string = "hello world"
upper_string = str.upper(original_string)
print(upper_string)This will also output:
Change a string into uppercase
HELLO WORLD