Anirudha
← Work
15 Days of CodingDay 9September 18, 2025~4 min read

Dictionary. Secret Auction

Try to run the code first. You might get it right.

Wrapping up early yesterday and unwinding before sleep worked. Dare I say, worked too well because I did not want to get up today at all even though I had a full night of good sleep. Maybe it was the lack of sleep catching up. Who knows? We will see tonight.

Alright, back to Python. I started today with learning about dictionaries and what they are. Dictionaries have two fields stored inside them. First field is the key and the second field is the value of that key. If we call a dictionary, it displays both these fields. But if we run a for loop in the dictionary and print the dictionary, we only see the key values. Pretty strange and unintuitive for me. But on the other side, they work similarly to lists and the value of the keys can be called using indexes. Other fun facts about dictionaries: we can fit other dictionaries inside dictionaries, we can fit lists inside dictionaries. So basically. we can put anything we want as a value for the keys in the dictionaries even though we can only assign a unique key. As you can imagine, it can quickly turn into a nightmare if you nest too many other things in a single dictionary so be careful and use the correct syntax to call the values of the keys you want. This also includes using the correct key and avoiding spelling mistakes.

The project for the day was creating a Secret Auction program. The way Secret Auction works is everyone bids their own individual bids based on their perceived value without letting others know. Once all the bids are collected, the winner of the Auction is the person who bids the most amount. It sounded pretty useless to me to drive the price up of an item because nobody knows the others amount, but if you are bidding to provide a service to an organization or a government, then this makes most sense and you can pick the lowest bid to win the auction. This way, you can get your work done for the least amount of money. USA, hit me up if you need a piece of this crazy program.

Back to coding then, to create the program, I created a short flowchart sketching what all will be needed in the program. The first thing I would need is inputs from the user asking their names and the amount they want to bid. Also an input to know how many users are bidding and each of their individual names and their amounts.

The next step I did was to save all these inputs directly in our dictionary. Like I said earlies, dictionaries are very similar to lists and so I found that we can directly use the max function on the dictionary to get the maximum value that is stored in the dictionary. I then used this value to find the key out and printed both the name and the amount of the user who became the winner of the auction. Just for fun, I also found out the minimum bid and declared them the winner because that is the point of these kind of auctions right?

That was it for today. After the last couple of days where I struggled to solve my problems, make sense of the logic and the crazy amount of time I needed to write even a single line of code, today was refreshingly easy. Makes me feel as if all the struggle was worth it and that I actually picked up a few skills and tricks. Anywho, tomorrow might not be as easy or it might even be easier. I look forward to finding it out. Until tomorrow!