-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsilent_auction.py
51 lines (42 loc) · 1.25 KB
/
silent_auction.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
gavel_art = '''
___________
\ /
)_______(
|"""""""|_.-._,.---------.,_.-._
| | | | | | ''-.
| |_| |_ _| |_..-'
|_______| '-' `'---------'` '-'
)"""""""(
/_________\\
`'-------'`
.-------------.
/_______________\\
'''
print(gavel_art)
print("Welcome to the secret auction program.")
bids_db: dict[str, int] = {}
def add_bid(name, bid):
"""
:type name: str
:type bid: int
"""
bids_db[name] = bid
def winner_bid():
winner = ""
bid = 0
for n, b in bids_db.items():
if b > bid:
winner = n
bid = b
return (winner, bid)
while True:
name = input("What is your name?: ")
bid = int(input("What is your bid?: $"))
add_bid(name, bid)
if input("Are there any other bidders? Type 'y' to continue 'n' to stop: ") == 'y':
pass
else:
break
os.system("cls")
print(winner_bid())