-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8.Secret-Auction.py
47 lines (42 loc) · 1.3 KB
/
8.Secret-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
import os
os.system('clear')
logo = '''
___________
\ /
)_______(
|"""""""|_.-._,.---------.,_.-._
| | | | | | ''-.
| |_| |_ _| |_..-'
|_______| '-' `'---------'` '-'
)"""""""(
/_________\\
.-------------.
/_______________\\
'''
print(logo + "\n"+"Welcome to the secret auction program.")
bidders = {}
multipleWinner = False
while True:
name = input("What is your name?: ")
bid = int(input("What is your bid?: "))
bidders[name] = bid
cont = input("Are there more bidders? ").lower()
if cont == "yes" or cont == 'y':
os.system('clear')
continue
else:
break
for i in bidders:
highest = 0
if bidders[i] > highest:
bidder = i
highest = bidders[i]
elif bidders[i] < highest:
continue
else:
bidder2 = i
multipleWinner = True
if multipleWinner == True:
print(f"{bidder} and {bidder2} have bid the same amount of ${highest}")
else:
print(f"The highest bidder is {bidder} with a bid of ${highest}")