-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day9.py
45 lines (38 loc) · 1.37 KB
/
Day9.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
logo = '''
___________
\ /
)_______(
|"""""""|_.-._,.---------.,_.-._
| | | | | | ''-.
| |_| |_ _| |_..-'
|_______| '-' `'---------'` '-'
)"""""""(
/_________\\
.-------------.
/_______________\\
'''
print(logo)
print("Welcome to the secret auction program.")
bids = {} #empty dictionary
is_bidding_finished = False
def clear(): # Prints 50 blank lines
print("\n" * 50)
def find_the_highest(bidding_record):
highest_bid = 0
winner = ""
for bidder in bidding_record:
bid_amount = bidding_record[bidder]
if bid_amount > highest_bid:
highest_bid = bid_amount
winner = bidder
print(f"The winner is {winner} with a bid of ${highest_bid}")
while not is_bidding_finished:
name = input("What's your name?: ")
price = int(input("What's your bid?: $"))
bids[name] = price
ask_to_continue = input("Are there any other bidders? Type 'yes or 'no'.\n").lower()
if ask_to_continue == "no":
is_bidding_finished = True
find_the_highest(bids)
elif ask_to_continue == "yes":
clear()