Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyDIP
#python 3.6.9 #PyDIP #this code is created by Rezaul Hoque on January 20,2022;contact: jewelmrh@yahoo.com,Dhaka, Bangladesh #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; from abc import ABC class Converter(ABC): def exchange(self, from_currency, to_currency, amount) -> float: pass class Exchanger1(Converter): def exchange(self, from_currency, to_currency, amount) -> float: print('Converting US Dollar into Tk') print(f'{amount} {from_currency} = {amount *83} {to_currency}') return amount * 83 class Exchanger2(Converter): def exchange(self, from_currency, to_currency, amount) -> float: print('Converting US Dollar into Taka') print(f'{amount} {from_currency} = {amount * 82} {to_currency}') return amount * 82 class Screen: def __init__(self, conv: Converter): self.conv= conv def start(self): self.conv.exchange('USD', 'Tk', 100) if __name__ == '__main__': exch= Exchanger1() screen = Screen(exch) screen.start()
run
|
edit
|
history
|
help
0
4
ivan2
global 3
Lesson3 part 2
total_tips
sai hw user table for loop
My code 4
Random integers
single_digit
Game4