Sep-14-2018, 10:05 AM
class Store: Day = 1 Money = 5 StoreName = "Lemonade Stand" StoreCount = 1 StoreCost = 3 StoreProfit = 1.5 StoreList = [] def __init__(self, StoreName, StoreCount, StoreCost, StoreProfit): self.StoreName = StoreName self.StoreCount = StoreCount self.StoreCost = StoreCost self.StoreProfit = StoreProfit @staticmethod def DisplayGameInfo(self): print("-----------------------------------") print("Day #" + str(self.Day)) print("Money = ${:0,.2f}".format(self.Money)) @staticmethod def DisplayStoreInfo(self): print("Store Name : %s, StoreCount = #%d " % (self.StoreName, self.StoreCount)) print("-----------------------------------") def BuyStore(self): if self.StoreCost <= Store.Money: self.StoreCount += 1 Store.Money -= self.StoreCost else: print("You don't have enough money") def NextDay(self): self.Day += 1 DailyProfit = self.StoreProfit * self.StoreCount Store.Money += DailyProfit Store.StoreList.append(Store) while True: Store.DisplayGameInfo(Store) Store.DisplayStoreInfo(Store) print("Available Options (N)ext Day, (B)uy Store, (E)xit") Choice = input('Please select an option') if Choice is 'B' or 'b': Store.StoreList[0].BuyStore(Store) elif Choice is 'N' or 'n': Store.StoreList[0].NextDay(Store) elif Choice is 'E' or 'e': break else: print("Bad Input") print("Thanks for playing Idle Tycoon")This shows there is no error, but when in run it and choose the first if statement, it only executes that statement and if i choose to execute the second if statement, it will just keep ignoring my command and continue to run the first if statement.
#NB the ide that i'm using is intellij and i'm also just a beginner
So anyone can help me? will appreciate it a lot. 've been stuck here for days and almost want to give up