day 9
This commit is contained in:
20
009/task.py
Normal file
20
009/task.py
Normal file
@ -0,0 +1,20 @@
|
||||
def get_winner(bids):
|
||||
highest_bid = 0
|
||||
for bidder in bids:
|
||||
if bids[bidder] > highest_bid:
|
||||
winner = bidder
|
||||
|
||||
print(f"The winner is {winner} with a bid of {highest_bid}")
|
||||
|
||||
auction_continues = "yes"
|
||||
bids = {}
|
||||
|
||||
while auction_continues == "yes":
|
||||
bidder = input("What is your name? : ")
|
||||
bid = int(input("What's your bid? : $"))
|
||||
|
||||
bids.update({bidder:bid})
|
||||
|
||||
auction_continues = input("Are there any other bidders? Type 'yes' or 'no.")
|
||||
|
||||
get_winner(bids)
|
||||
Reference in New Issue
Block a user