1
Home
Tirsvad edited this page 2026-11-15 09:49:43 +01:00

English · Dansk · Bahasa Melayu

Secret Auction Program

A beginner-friendly blind auction for the terminal: enter bids in secret and see who wins.

What is it?

Day 9 of the Udemy course 100 Days of Code: The Complete Python Pro Bootcamp. Each bidder enters a name and a bid, which are stored in a dictionary (name to bid). After each bidder the program asks whether there are more bidders and, if so, clears the screen so the next bidder cannot see earlier bids. When everyone has bid, the program announces the winner.

What the exercise teaches

  • Storing and updating data in dictionaries
  • Looping until the user says there are no more entries
  • Finding the highest value in a dictionary with max and a key function
  • Separating the logic from the input and output, and writing small automated tests

What it does

  • Any number of bidders in one session
  • The screen is cleared between bidders so bids stay secret
  • Input validation: a friendly message for a bid that is not a valid, non-negative number or for an unclear yes/no answer
  • A bidder who bids again replaces the earlier bid, and the first bidder wins a tie

Next