Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyEq
#python 3.6.9 #pyEq #this code is created by Rezaul Hoque on January 11,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; class Food: def __init__(self, food,color,type): self.food = food self.color = color self.type = type def __eq__(self, other): if isinstance(other, Food): return self.type == other.type return False jilebi = Food('Jilebi', 'Golden', 'Cooked') fruitcake = Food('Fruit Cake','Brown', 'Baked') croissant = Food('Croissant', 'White','Baked') print(jilebi == fruitcake) print(fruitcake == croissant) ricecake = ('Rice Cake', 'White', 'Baked') print(ricecake == 20)
run
|
edit
|
history
|
help
0
p1
PyTypeSub
validation
Payth
Lab_III_3_01_12_2020
static
delta5
(P3) Fibonacci 2
perform_math.py
Q1