bidding program in python

Solutions on MaxInterview for bidding program in python by the best coders in the world

showing results for - "bidding program in python"
Théodore
11 Jan 2019
1import os
2logo = '''
3                         ___________
4                         \         /
5                          )_______(                           ___   
6                          |"""""""|_.-._,.---------.,_.-._   |   |
7                          |       | | |               | | ''-|    |
8                          |       |_| |_             _| |_..-|    |
9                          |_______| '-' `'---------'` '-'    |___|
10                          )"""""""(
11                         /_________\\
12                         
13                       .-------------.
14                      /_______________\\
15'''
16print(logo)
17
18bids = {}
19bidding_finished = False
20
21def find_highest_bidder(bidding_record):
22  highest_bid = 0
23  winner = ""
24  # bidding_record = {"Angela": 123, "James": 321}
25  for bidder in bidding_record:
26    bid_amount = bidding_record[bidder]
27    if bid_amount > highest_bid: 
28      highest_bid = bid_amount
29      winner = bidder
30  print(f"The winner is {winner} with a bid of ${highest_bid}")
31
32while not bidding_finished:
33  name = input("What is your name?: ")
34  price = int(input("What is your bid?: $"))
35  bids[name] = price
36  should_continue = input("Are there any other bidders? Type 'yes or 'no'.\n")
37  if should_continue == "no":
38    bidding_finished = True
39    find_highest_bidder(bids)
40  elif should_continue == "yes":
41    os.system("cls")