Skip to content

Commit

Permalink
corrected an incorrect prompt and allowed user to exit via q on the i…
Browse files Browse the repository at this point in the history
…mproper answer prompt
  • Loading branch information
Bikatr7 committed Apr 30, 2024
1 parent 32e79f6 commit f838d3d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/score_rater.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,14 @@ def check_answers_word(Word:Word, user_guess:str, prompt:str, is_romaji_type:boo
rom_answers = [reading.romaji for reading in Word.readings] + [reading.furigana for reading in Word.readings]
reg_answers = [synonym.value for synonym in Word.answers]

if(user_guess == 'q'): ## if the user wants to quit the program do so
Toolkit.exit_seisen()

answers = set(rom_answers) if is_romaji_type else set(reg_answers)
alt_answers = set(reg_answers) if is_romaji_type else set(rom_answers)

if(user_guess in alt_answers and user_guess not in answers):
user_guess = input(f"\nYou entered a {'reading' if is_romaji_type else 'meaning'} instead of a {'meaning' if is_romaji_type else 'reading'}. Please enter the correct {'meaning' if not is_romaji_type else 'reading'} : ")
user_guess = input(f"\nYou entered a {'reading' if not is_romaji_type else 'meaning'} instead of a {'meaning' if not is_romaji_type else 'reading'}. Please enter the correct {'meaning' if not is_romaji_type else 'reading'} : ")

if(user_guess == 'q'): ## if the user wants to quit the program do so
Toolkit.exit_seisen()

if(user_guess not in answers and user_guess.strip() != ''): ## checks if user_guess is a typo
user_guess = ScoreRater.check_typo(Word, user_guess, prompt, is_romaji_type=is_romaji_type)
Expand Down

0 comments on commit f838d3d

Please sign in to comment.