Wednesday, February 12, 2020

how to check garbage collector is enable or not

import gc
print(gc.isenabled())

output
True

example2:

import gc
print(gc.isenabled())
gc.disable()
print(gc.isenabled())

output:
True

False

how to declare class in python

class Student:
    def __init__(self,x,y,z):
        self.name=x
        self.rollno=y
        self.marks=z
    def display(self):
        print("name:",self.name)
        print("rollno:",self.rollno)
        print("marks:",self.marks)
 
     
s=Student("anil",100,90)
s.display()

output:
name: anil
rollno: 100
marks: 90

How to write a basic functions in python



python class topic video