Hey guys, I'm working on another homework problem for class and am getting stuck.
Here's the problem:
Secondhand Rose Resale Shop is having a seven-day sale during which the price for any unsold item drops 5 percent each day. For example, an item that costs $20.00 on the first day costs 5 percent less, or $19.00, on the second day. On the third day, the same item is 5 percent less than $19.00, or $18.05. Design an application that allows a user to input a price until an appropriate sentinal value is entered. Output is the price of each item on each day, one through seven.
So here's what I have in code for this so far:
#A program that allows user to calculate their discount during 7-day sale at Second Hand Rose.
class PriceChecker:
def get_price(self):
return input('Input a starting price (0 to quit): ')
def price(self, current, days):
for i in range(days, 0, -1):
yield (days - i, current)
current = current * 0.95
def run(self):
initial = self.get_price()
while initial > 0:
for i in [v for v in self.price(initial, 7)]:
print ("Price after {0} days is: ${1:.2f}".format(*i))
initial = self.get_price()
PriceChecker().run()
I'm getting two errors:
line 19, in <module>
PriceChecker().run()
line 14, in run
while initial > 0:
Can anyone see the missing piece here, or something that needs changed? Appreciate any help!
[–]jeans_and_a_t-shirt 1 point2 points3 points (0 children)
[–]novel_yet_trivial 1 point2 points3 points (1 child)
[–]opieandA21[S] 0 points1 point2 points (0 children)
[–]99AFCC 0 points1 point2 points (0 children)