Skip to content

Latest commit

 

History

History
32 lines (27 loc) · 1.41 KB

File metadata and controls

32 lines (27 loc) · 1.41 KB

Python - Word Count Game

Rules: 2 players are asked to guess how many times a word is in a song. The closest answer to the correct one wins the round.

Technologies

  • Python

Steps

A Python code was developed to allow the following actions:

  • Display a numbered dictionary of the available songs (Brazilian MPB music) for the player to choose from;
  • Create a dictionary of lyrics that match the numbers of songs previously displayed;
  • Ask the player to choose a song number;
  • Display the chosen song name;
  • Match the chosen song number to its lyrics;
  • Ask for players' names;
  • Generate a random word from a song;
  • Clean lyrics and return the frequency of each word in it in a dictionary;
  • Ask players to guess the random word frequency in the song;
  • Display players' turns and asks each how many times the same word is in a song;
  • Check which player got closer to the right answer and score points;
  • Display the correct answer for the round and the current score for each player;
  • Ask if players want to (1) continue or (2) end the game;
  • If (1), a new random word is generated and players switch turns until they choose to end the game;
  • If (2), displays final score and winner.

Conclusion

  • Try out the game on the Jupyter Notebook available for this project, in which you can also check out more details of the code!

Contact