From Confusion to Clarity 3
From the "Higher or Lower" game I learned,
The f-strings (formatted string literals) are a way to dynamically embed expressions inside strings {} , which makes the code more readable and concise.
So it is used many times in that project. For example f " {name} , a {category} from {country} ".
For using dictionary in this game to store information about each celebrity or entity because dictionaries are a highly efficient data structure for representing objects with multiple attributes.
I was really confusion for how to get below mentioned logic in this project.
When the user makes a correct guess, the entity with more followers (the correct answer) is supposed to become the new "Compare 1"(ac1) for the next round.
Then randomly selects a new "Compare 2" (ac2) ensuring it is not the same as "Compare 1".
This is crucial to keep the game dynamic and interesting, as it maintains one of the entities from the previous round, so the user can continue building on their knowledge
Subscribe to my newsletter
Read articles from Arunmathavan K directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by