We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4e3021d commit c43329cCopy full SHA for c43329c
1 file changed
Day_9/bidding.py
@@ -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