From 3b538250c4cb51e7c6077a6c52eae4e19a64cfb3 Mon Sep 17 00:00:00 2001 From: Tanguy Deleplanque Date: Mon, 16 Jun 2025 12:29:48 +0200 Subject: [PATCH] day 9 --- 009/task.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 009/task.py diff --git a/009/task.py b/009/task.py new file mode 100644 index 0000000..fe11280 --- /dev/null +++ b/009/task.py @@ -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) \ No newline at end of file