Returns a copy of a string in capitals.
Synopsis
text.upper()
Description
Like lower, upper returns a new string and leaves the original alone.
Return value
A new str.
Example
name = "ada"
print(name.upper())
print(name)
It prints:
ADA
ada
Common mistake
print(upper("ada"))
Python stops with:
NameError: name 'upper' is not defined
upper is a method, not a function on its own. Call it on the string: "ada".upper().
See also
Last updated 2 weeks ago