-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsilent-bid.py
executable file
·59 lines (42 loc) · 1.51 KB
/
silent-bid.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
52
53
54
55
56
57
from replit import clear
logo = '''
___________
\ /
)_______(
|"""""""|_.-._,.---------.,_.-._
| | | | | | ''-.
| |_| |_ _| |_..-'
|_______| '-' `'---------'` '-'
)"""""""(
/_________\\
.-------------.
/_______________\\
'''
def start ():
another_bidder = True
bidders ={}
bids = []
bidder_name = ""
bidder_bid = 0
max_bid = 0
while another_bidder == True:
clear()
print(logo)
print("\nWelcome, Anonymous bidder, to the silent auction. Shhhhhh!\n")
bidder_name = input("What is your name?\n --: ").lower()
bidder_bid = int(input("\nWhat is your bid?\n --: $"))
bidders[bidder_name] = bidder_bid
answer = input("\n Is there another one interested? type 'yes' or 'no'\n --: ").lower()
if answer == 'yes':
another_bidder = True
else:
another_bidder = False
for bidder in bidders:
bids.append(bidders[bidder])
key_list = list(dict.keys(bidders))
val_list = list(dict.values(bidders))
max_bid = max(bids)
index = val_list.index(max_bid)
name_of_winner = key_list[index]
print(f"\nThe winner is {name_of_winner} with a bid of ${max_bid}!\n\n")
start()