-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlindAuction.py
More file actions
36 lines (26 loc) · 924 Bytes
/
Copy pathBlindAuction.py
File metadata and controls
36 lines (26 loc) · 924 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
29
30
31
32
33
34
35
36
bid_dictionary = {}
#make a boolean statement which will check if bidding is continuing
bidding_continue = True
while bidding_continue:
name = input("What is your name? ")
#bid will either be a float or an int
bid = float(input("What is your bid? "))
# ask if any more bid
cont = input("Would you like to continue (yes/no)? ")
if cont.lower() == "yes":
bidding_continue = True
elif cont.lower() == "no":
bidding_continue = False
else:
print("Thank you for bidding")
#add the bid to the main bid dictionary which we can retrieve later
bid_dictionary[name] = bid
#initialize highest_bid and name beforehand
highest_bid = 0
winner = ""
for name in bid_dictionary:
bid_amount = bid_dictionary[name]
if bid_amount > highest_bid:
highest_bid = bid_amount
winner = name
print(f"The winner is {winner} with the bid of {highest_bid}")