Advertisement
shegues

Blind_Auction

Jan 18th, 2021
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. import os
  2. def cls():
  3.     os.system('cls' if os.name == 'nt' else 'clear')
  4.  
  5. dictionary_auction = {}
  6. list_of_bids = []
  7. more_users = True
  8. while more_users == True:
  9.   name = input("Give your name please : \n")
  10.   bid = int(input("Give me your bid please: \n"))
  11.   new_bidder = input("Is there any other bidder? \n")
  12.   if new_bidder == "yes":
  13.     cls()
  14.   else:
  15.     more_users = False
  16.   dictionary_auction[name] = bid
  17.   list_of_bids.append(bid)
  18.   highest_bid = max(list_of_bids)
  19.  
  20. print(dictionary_auction)
  21. print(list_of_bids)
  22. print(highest_bid)
  23. for name, bid in dictionary_auction.items():
  24.     if bid == highest_bid:
  25.         winner = name
  26. print(f"the winner is : {winner}")
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement