Given a string str containing only lowercase letters, generate a string with the same letters, but in uppercase.
Example 1:
Input:
str = "geeks"
Output: GEEKS
Example 2:
Input:
str = "geeksforgeeks"
Output: GEEKSFORGEEKS
Your Task:
You don't need to read input or print anything. Your task is to complete the function to_upper() which takes the string str as an argument and returns the resultant string.
Expected Time Complexity: O(length of the string).
Expected Auxiliary Space: O(1).
Constraints:
1 ≤ length of the string ≤ 50

Difficulty: EASY
Tags: String algorithms

Data structures
Skill types: Data structures
Expected Time Complexity: O(length of the string).
Expected Auxiliary Space: O(1).

Starter code:
#User function Template for python3
class Solution:
    def to_upper(self, str):
        # code here

Solutions:
class Solution:

	def to_upper(self, str):
		self.str = str
		str = str.upper()
		return str


class Solution:

	def to_upper(self, str):
		return str.swapcase()


class Solution:

	def to_upper(self, str):
		result = ''
		for i in str:
			result += i.upper()
		return result


class Solution:

	def to_upper(self, str):
		result = ''
		for a in str:
			result += a.upper()
		return result


class Solution:

	def to_upper(self, str):
		ans = ''
		for i in str:
			ans += chr(ord(i) - 32)
		return ans


class Solution:

	def to_upper(self, str):
		uppercase = ''
		for i in str:
			if ord(i) >= 97 and ord(i) <= 122:
				uppercase = uppercase + chr(ord(i) - 32)
			else:
				uppercase = uppercase + i
		return uppercase


class Solution:

	def to_upper(self, str):
		ans = ''
		for char in str:
			ans += char.upper()
		return ans


class Solution:

	def to_upper(self, str):
		string = []
		for x in str:
			if x.isupper() == True:
				x = x.lower()
				string.append(x)
			else:
				x = x.upper()
				string.append(x)
		result = ','.join(string)
		result = result.replace(',', '')
		return result


class Solution:

	def to_upper(self, str):
		t = ''
		for i in str:
			if i.isupper():
				t += i.lower()
			elif i.islower():
				t += i.upper()
		return t


class Solution:

	def to_upper(self, str):
		ans = ''
		for i in range(0, len(str)):
			ch = ord(str[i]) - 32
			ans += chr(ch)
		return ans


class Solution:

	def to_upper(self, str):
		out_str = ''
		for cha in str:
			out_str += cha.upper()
		return out_str


class Solution:

	def to_upper(self, str):
		ans = ''
		for i in str:
			ans = ans + chr(ord(i) % 97 + 65)
		return ans


class Solution:

	def to_upper(self, str):
		res = ''
		for i in str:
			res = res + i.upper()
		return res


class Solution:

	def to_upper(self, str):
		d = ''
		for i in str:
			d += i.upper()
		return d


class Solution:

	def to_upper(self, string):
		return string.upper()


import string

class Solution:

	def to_upper(self, str):
		p = str.upper()
		return p


class Solution:

	def to_upper(self, str):
		str_output = ''
		for char in str:
			if ord(char) >= ord('a') and ord(char) <= ord('z'):
				uppercase_char = chr(ord(char) - ord('a') + ord('A'))
				str_output += uppercase_char
			else:
				str_output += char
		return str_output


class Solution:

	def to_upper(self, str, st=''):
		for i in str:
			if 'a' <= i <= 'z':
				st += chr(ord(i) - 32)
			else:
				st += i
		return st


class Solution:

	def to_upper(self, str):
		if str.islower():
			return str.upper()
		else:
			return str.lower()


class Solution:

	def to_upper(self, s):
		return s.upper()


class Solution:

	def to_upper(self, str):
		ans = ''
		for c in str:
			if 97 <= ord(c) <= 122:
				ans += chr(ord(c) - 32)
			elif 65 <= ord(c) <= 90:
				ans += chr(ord(c) + 32)
		return ans


class Solution:

	def to_upper(self, str):
		s = ''
		for i in str:
			s += i.upper()
		return s


class Solution:

	def to_upper(self, str):
		for i in range(len(str)):
			ch = str[i]
			ch = ord(ch)
			ch = ch - 32
			ch = chr(ch)
			str = str[:i] + ch + str[i + 1:]
		return str


class Solution:

	def to_upper(self, str):
		strr = ''
		for i in range(len(str)):
			strr += chr(ord(str[i]) - 32)
		return strr


class Solution:

	def to_upper(self, str):
		ans = ''
		for c in str:
			ans += c.upper()
		return ans