Question: Write a function uppercase(str) that converts a string to upper case. For example, if the input is Hello World Then your function should return the


Write a function uppercase(str) that converts a string to upper case. For example, if the input is Hello World Then your function should return the string HELLO WORLD The function should ignore numbers if the input is cse1010 The output should be CSE1010 If your function is given an empty string, it should return an empty string. LAB ACTIVITY 27.3.1: Midterm 2021 Problem 4 of 7 main.py Le 1 def uppercase(str): 2 newstr - 3 if str - return". 4 for ch in str: 5 if ord(ch)> 97 and ord(ch) - 122: 6 newstr chr(ord(ch)-32) 7 newstech 8 return newstr 9 11 If none main': user_string - input() 13 print(uppercaseCuser strinb) 14 LAB ACTIVITY 27.3.1: Midterm 2021 Problem 4 of 7 main.py AWN 1 def uppercase(str): newstr 3 if str ": return 4 for ch in str: 5 if ord(ch)>- 97 and ord(ch)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
