Write a Python class which has at least two methods: getString: to get a string from console input printString: to print the string in upper case.


Topic: Write a Python class which has at least two methods: getString: to get a string from console input printString: to print the string in upper case.

Solution

class IOString(object):
    def __init__(self):
        self.s = ""
    def getString(self):
        self.s = input()
    
    def printString(self):
        print(self.s.upper())
strObj = IOString()
strObj.getString()
strObj.printString()



List all Python Programs