202-08-02: 5. Secret Auction
Yonny
1 min read
Secret Auction code.
from replit import clear
# HINT: You can call clear() to clear the output in the console.
bid_list = {}
more_bidder = "yes"
high_amount = 0
while more_bidder == "yes":
name = input("What is your name?: ")
amount = int(input("What is your bid?: $"))
bid_list[name] = amount
more_bidder = input("Are there any other bidders? Type 'yes' or 'no'.\n")
if more_bidder == "yes":
clear()
for name in bid_list:
if bid_list[name] > high_amount:
high_bidder = name
high_amount = bid_list[name]
print(f"The winner is {high_bidder} with a bid of ${high_amount}")
# print(bid_list)
0
Subscribe to my newsletter
Read articles from Yonny directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by