Skip to content

Commit c43329c

Browse files
committed
Day 10
1 parent 4e3021d commit c43329c

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Day_9/bidding.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
3+
def find_highest_price(biding_dictionary):
4+
winner = ""
5+
highest_bid = 0
6+
for bidder in biding_dictionary:
7+
bind_amount = biding_dictionary[bidder]
8+
if bind_amount > highest_bid:
9+
highest_bid = bind_amount
10+
winner = bidder
11+
print(f"The winner is {winner} with the highest bid of ${highest_bid}")
12+
13+
bids = {}
14+
continue_bidding = True
15+
while continue_bidding:
16+
name = input("Please enter your name: ")
17+
price = int(input("What is your bid? $"))
18+
bids[name] = price
19+
should_continue_bidding = input("Would you like to continue? (y/n) \n ").lower()
20+
if should_continue_bidding == "n":
21+
continue_bidding = False
22+
find_highest_price(bids)
23+
elif should_continue_bidding == "y":
24+
print("\n" * 25)

0 commit comments

Comments
 (0)