Posts

Showing posts from August, 2020

Class in python

# 1st Example # Normal use of class as usually we do. # Space in not compulsory.I add space for your easy understanding. #Pass is use for to pass the programme .But not for pass the programme.Because ex=if you make a function means def so pass not need.But if there is nothing after class means empty then pass need to add. class Student: pass harry=Student() me=Student() harry.name= "Harry" harry.Standard= "All rounder" harry.whatisharry= "My SIR.If you are in searching any teacher or brother go to:https://www.youtube.com/codewithharry \n But only in hindi language so sad Lol" me.name= "Alex" me.Standard= "10th in 2020 Ok .who are reading this" me.whatisme= "A student in 2020 .Lol" print (harry.whatisharry) #2nd Example. Use of dict in class class Alex: pass alex=Alex() alex.name= "Alexxxxx" alex.fun= "In Programing" print (alex. __dict__ ) # 3rd Example. Use of init in class class Alex: def __in