Sunday, 23 January 2022

Write a Python class which has two methods get_String and print_String. get_String accept a string from the user and print_String print the string in upper case. Further modify the program to reverse a string word by word and print it in lower case.

Slip 8 Q 2

CODE :

class Str1():
    def __init__(self,demo=0):
        self.demo=demo
       
    def set_String(self,demo):
        demo=demo.upper()
        self.demo=demo
   
    def print_streing(self):
       
        return self.demo
       
A=Str1()
str1=input('enter a string to display :')
A.set_String(str1)
print('Upper string :',A.print_streing())

OUTPUT:




2 comments:

Write a Java program to display given extension files from a specific directory on server machine.

 DOWNLOAD     SLIP14Q2 /** * STEPS TO RUN CODE * Step 01 compile the code * Step 02 run the code * Step 03 give a file directory locatio...