Untitled
unknown
python
3 years ago
1.3 kB
4
Indexable
#herkes ölür sevdigi icin biz ölürüz dostlar icin
#bakirkoy meydan gerisi heycan
import sys
class FlowerShop:
def __init__(self):
self.price=0
print("Welcome to SEN1011 Flower Shop.")
def __str__(self):
print("""
1. Lily($3 each)
2. Peony($5 each)
3. Rose($4 each)
4. Clove($2 each)
""")
def returnPrice(self):
return "You should pay:"+str(self.price)+"\n"+"Good Days"
def inputForFlower(self):
self.choice=input("Enter the flower type you want to buy:")
if self.choice=="1":
self.price+=3
elif self.choice=="2":
self.price+=5
elif self.choice=="3":
self.price+=4
elif self.choice=="4":
self.price+=2
else:
print("Wrong Input")
sys.exit()
def calculateTheAmount(self):
self.amount=input("How many of them do you want to buy?")
self.price=self.price*int(self.amount)
while True:
try:
FS=FlowerShop()
FS.__str__()
FS.inputForFlower()
FS.calculateTheAmount()
print(FS.returnPrice())
except:
print("Wrong Input")
sys.exit()
Editor is loading...