Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyClass2
#Python 2.7.17 #PyClass2: Built-in functions and attributes #this code is created by Rezaul Hoque on December 13,2021;contact: jewelmrh@yahoo.com #note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; # abstract class class Garden: def detail(self): pass class VegGarden(Garden): " " " It is on the north side of the garden." " " # Overriding abstract method def detail(self): print("This is a vegetable garden") class FlowGarden(Garden): " " " It is on the south." " " # Overriding abstract method def detail(self): print("This is a flower garden") bag1 = VegGarden() bag2 = FlowGarden() bag1.detail() bag2.detail() #Buit-in functions print(hasattr(bag1,'row')) print(setattr(bag1,'row',4)) print (getattr(bag1,'row')) print(setattr(bag2,'location','south')) print(bag2.location) #delattr(FlowGarden,'location') #print(FlowGarden.location) #Delete Class/attribute del VegGarden #Built-in attributes print(Garden.__dict__) print(Garden.__name__) print(Garden.__module__) print(Garden.__bases__) print(FlowGarden.__bases__) print(Garden.__doc__) print(FlowGarden.__doc__)
run
|
edit
|
history
|
help
0
working with strings
Dictionary comprehension - convert to lowercase
gvgvg
gameboy
NormalizedTags
PyClassInit
0aa6d60d0504c8470fc90c1d5cbf06083cdaadeab6e102bf90732ac2ab66dfdc
runologist
espacio_blanco
Filter dictionaries with specific keys