Here is how to make a string uppercase and lowercase!
xxxxxxxxxx
original_string = "Hi there"
string_uppercase = original_string.upper()
print(string_uppercase)
string_lowercase = string_uppercase.lower()
print(string_lowercase)
string.upper() makes the string uppercase, but we can only save this uppercase value in a variable. That is why we have to print it in order to display it. The same goes with string.lower(). This makes the entire string into lowercase characters. But again, we must print it in order to display it.
Note that these two functions only work with strings and not with float or integer values, in other words numbers! Good luck coding!
Answer By: Codexel ;)
xxxxxxxxxx
text = "Random String"
text = text.upper() #Can also do
text = upper(text)
print(text)
>> "RANDOM STRING"
xxxxxxxxxx
original = Hello, World!
#both of these work
upper = original.upper()
upper = upper(original)
xxxxxxxxxx
my_string = "this is my string"
print(my_string.upper())
# output: "THIS IS MY STRING"
xxxxxxxxxx
# example string
string = "this should be uppercase!"
print(string.upper())
# string with numbers
# all alphabets should be lowercase
string = "Th!s Sh0uLd B3 uPp3rCas3!"
print(string.upper())
xxxxxxxxxx
# String to Uppercase by Matthew Johnson
myStr = "Dna"
print(myStr.upper())
#OUTPUT: "DNA"
xxxxxxxxxx
S1 = 'Python'
#creates a new string with the contents of S uppercased.
S2 = S1.upper()
print(S2)