Sunday, 23 January 2022

Write a Python class named Student with two attributes student_name, marks. Modify the attribute values of the said class and print the original and modified values of the said attributes.

Slip 15 Q 1

CODE :


class Student:
    def __init__(self, Student_name, marks):
        self.Student_name=Student_name
        self.marks=marks
   
    def get_marks(self):
        print("\nOriginal name and values")
        print(self.Student_name,'marks : ',self.marks)
       
    def modify_marks(self):
        self.Student_name1=input('Enter modifyed name : ')
        self.marks1=int(input('Enter modifyed marks : '))
        print(self.Student_name1,'modifyed marks',self.marks)
       
    def modifyed_marks(self):
        print("\nmodified name and values")
        print(self.Student_name1,'marks : ',self.marks1)
       
x=Student('AMAR',81)
x.get_marks()
x.modify_marks()

x.get_marks()
x.modifyed_marks()

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