-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblind_auction.py
More file actions
29 lines (26 loc) · 845 Bytes
/
Copy pathblind_auction.py
File metadata and controls
29 lines (26 loc) · 845 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
# Blind Auction program . .
import os
# empty dictionary . .
bids = {}
biding_finished = False
# function for highest bidder . .
def highest_bidder(bidding_record):
highest_bid = 0
winner = ""
for bidder in bidding_record:
bid_amount = bidding_record[bidder]
if bid_amount > str(highest_bid):
highest_bid = bid_amount
winner = bidder
print(f"The winner is {winner} with bid of ${highest_bid}")
# continue loop for auction . .
while not biding_finished:
name = input("Enter your name : ")
price = input("What is your bid : $")
bids[name] = price
should_continue = input("Are there any other bidders ? 'yes' or 'no' ")
if should_continue == 'no':
biding_finished = True
highest_bidder(bids)
elif should_continue == 'yes':
os.system('cls')