Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyTeleBook
#python 3.6.9 #PyTeleBook: example of switch using class #this code is created by Rezaul Hoque on April 10,2022. #contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.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; class Tele(object): def tele_1(self): self.first= 'hh' self.last= 'cc' self.num= 5432 self.cat= 'professional(former)' print("name:",self.first ,self.last) print("number:",self.num) print("category:",self.cat) def tele_2(self): self.first= 'tt' self.last= 'nn' self.num= 000 self.cat= 'professional(current)' print("name:",self.first ,self.last) print("number:",self.num) print("category:",self.cat) def tele_3(self): self.first= 'yy' self.last= 'mm' self.num= 321 self.cat= 'personal' print("name:",self.first ,self.last) print("number:",self.num) print("category:",self.cat) def getMethod(self,op): calMethod="tele_"+str(op) method=getattr(self,calMethod,lambda : 'Insert number between 1 and 3') return method() print("Telephone Book:\n") print("(1)Former (2)Current (3)Personal\n") choice=int(input("Select:\n")) t=Tele() t.getMethod(choice)
run
|
edit
|
history
|
help
0
Email_Python
check this converting week number (int) into week day name (string) [solved]
pattern
Gh
Distance between latititude and longitude
Sum
Homework exercise
Lesson#6
factorial.py
Юра и заселение