Monday, 24 January 2022

Python Program to Create a Class in which One Method Accepts a String from the User and Another method Prints it.

Slip 30 Q 2

CODE :

class stringmethod():
    def __init__(self):
        self.string=""
 
    def get(self):
        self.string=input("Enter string: ")
 
    def put(self):
        print("String is:")
        print(self.string)

obj=stringmethod()
obj.get()
obj.put()


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