Sunday, 23 January 2022

Write a Python script using 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

Slip 5 Q 1

CODE :

class Str1():
    def __init__(self,demo=0):
        self.demo=demo
       
    def set_String(self,demo):
        self.demo=demo
   
    def print_streing(self):
        str=self.demo
        print(str.upper())
       
A=Str1()
rowinput=input('enter a string :')
A.set_String(rowinput)
A.print_streing()

OUTPUT :

No comments:

Post a Comment

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...