I have to create a function that changes lower case letters to upper case letters using only the ord and chr functions.
This is what I have so far, but the problem is it is not returning all the letters, only the first letter.
def changeToUpperCase(text):
for i in text:
i = ord(i) - 32
text = chr(i)
return text
def main():
text = input("Please type a random sentence.")
text = changeToUpperCase(text)
print("Step 2 -> ", text)
def changeToUpperCase(text):
new_text = ""
for i in text:
i = ord(i) - 32
new_text = new_text + chr(i)
return new_text
you need to wait to return until you have parsed the whole thing