ENTER pressed / fixed issue

This commit is contained in:
Hawai 2021-06-07 10:46:09 +02:00
parent 2b53ec62dc
commit 492a245c34
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,8 @@
import os import os
import csv import csv
import random import random
import time
from rich.console import Console from rich.console import Console
from rich.markdown import Markdown from rich.markdown import Markdown
@ -77,9 +79,10 @@ def _wait_user_answ(answer):
return False return False
else: # ===> if only one possible answer else: # ===> if only one possible answer
result = input("\nWhat is your choice : ") result = input("\nWhat is your choice : ")
if result.lower() == "q" or result.lower() == "quit": if result.lower() == "q" or result.lower() == "quit":
return 3 return 3
if result in answer["ANSWER"]: if result in answer["ANSWER"] and len(result) != 0:
return True return True
else: else:
return False return False
@ -118,6 +121,7 @@ def main():
_display_question(csv_list[count]) _display_question(csv_list[count])
# Check if correct answer # Check if correct answer
result = _wait_user_answ(csv_list[count]) result = _wait_user_answ(csv_list[count])
if result == 3: # quit! if result == 3: # quit!
get_out_while = True get_out_while = True
elif result: # right answer! elif result: # right answer!
@ -128,5 +132,6 @@ def main():
# End of while # End of while
_stats(csv_list, player) _stats(csv_list, player)
if __name__ == "__main__": if __name__ == "__main__":
main() main()