upper() method converts all lowercase characters in a string into uppercase characters and returns it
In Python, strings are one of the most commonly used data types, and they offer a variety of methods to manipulate and process strings. One such method is upper()
, which is used to convert all the characters in a string to uppercase.
The upper()
method is a built-in function in Python that takes no arguments and returns a new string with all the characters in the original string converted to uppercase. For example, if you have a string "hello world", calling the upper()
method on this string will return "HELLO WORLD".
The upper()
method is useful when you need to compare strings in a case-insensitive manner, or when you need to convert user input to a standard format. It can also be used in combination with other string methods like replace()
or split()
to manipulate strings further.
It's important to note that the upper()
method does not modify the original string, but instead returns a new string with all the characters converted to uppercase. Therefore, you will need to store the result of the upper()
method in a new variable or update the original variable to reflect the change.
In summary, the upper()
method in Python is a useful tool for converting strings to uppercase and can be used in various contexts where case-insensitivity is required.
Australia
UK
UAE
Singapore
Canada
New
Zealand
Malaysia
USA
India
South
Africa
Ireland
Saudi
Arab
Qatar
Kuwait
Hongkong
Copyright 2016-2023 www.programmingshark.com - All Rights Reserved.
Disclaimer : Any type of help and guidance service given by us is just for reference purpose. We never ask any of our clients to submit our solution guide as it is, anywhere.