-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday9_secret_auction.py
More file actions
28 lines (24 loc) · 890 Bytes
/
day9_secret_auction.py
File metadata and controls
28 lines (24 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def secret_auction():
def find_highest_bid(bids_dict):
highest_bid = 0
winner = ""
for bidder in bids_dict:
bid_amount = bids_dict[bidder]
if bid_amount > highest_bid:
highest_bid = bid_amount
winner = bidder
print(f"The winner is {winner} with a bid of ${highest_bid}")
bids = {}
continue_bidding = True
while continue_bidding:
name = input("What is your name?: ")
price = int(input("What is your bid?: "))
should_continue = input("Are there any other bidders? Type 'yes' or 'no': ").lower()
bids[name] = price
if should_continue == "no":
continue_bidding = False
find_highest_bid(bids)
elif should_continue == "yes":
print("\n" * 50)
# Call the function to run it
secret_auction()