You need to create a dictionary for flashcards where each card consists of a term and its definition. The user inputs the number of cards, then provides terms and definitions for each card. The goal is to ensure that terms and definitions are unique. After creating the dictionary, you prompt the user to guess definitions for the terms and provide feedback on whether their guesses are correct, while also identifying if their guess matches a different term's definition.
1. Input Collection:
- Start by initializing an empty dictionary to store terms and their definitions.
- Ask the user to input the number of cards they want to create.
2. Unique Term and Definition Validation:
- For each card, prompt the user to enter a term. Check if this term already exists in the dictionary. If it does, keep asking for a new term until a unique one is provided.
- Similarly, prompt the user to enter a definition and check if it is already associated with a different term. If it is, keep asking for a new definition until a unique one is found.
3. Storing Data:
- Once unique term and definition are obtained, store them in the dictionary with the term as the key and the definition as the value.
4. User Quiz:
- After all terms and definitions are entered, prompt the user to input definitions for each term.
- Compare the provided definition with the correct definition from the dictionary. If the definition is correct, notify the user; otherwise, provide feedback with the correct definition and indicate if their guess matches a different term’s definition.
By following these steps, you ensure that each term and definition is unique and provide informative feedback based on user input.
No comments:
Post a Comment