From d37c96daea46e70947063da0b9887a9ca5c26ac3 Mon Sep 17 00:00:00 2001 From: waldek Date: Tue, 8 Jun 2021 21:50:59 +0200 Subject: [PATCH] integrates the explication by Abdellah and fixes the empty answer mentioned by David --- data/list_book1.csv | 2 +- poc_standalone.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/data/list_book1.csv b/data/list_book1.csv index 038e13c..9ac58d5 100755 --- a/data/list_book1.csv +++ b/data/list_book1.csv @@ -1,4 +1,4 @@ -LEVEL,ANSWER,QUESTION,1,2,3,4,5,6,,, +LEVEL,ANSWER,QUESTION,1,2,3,4,5,EXPLICATION,,, 010-160,3,Which of the following is **not** a function of the Linux kernel?,Allocating memory for use by programs,Allocating CPU time for use by programs,Creating menus in GUI programs,Controlling access to the hard disk,Enabling programs to use a network,"GUI programs create menus with the help of a library that's designed for this purpose; this is not a function of the Linux kernel. Thus, option 3 is a non-kernel function, and is correct. The kernel allocates memory and CPU time, and it also controls access to disk and network hardware, so options 1, 2, 4, and 5 all describe kernel functions and are incorrect.",,, 010-160,1,Which of the following is an example of an embedded Linux OS?,Android,SUSE,CentOS,Debian,Fedora,"Android is used on cell phones and other small portable devices, and as such it qualifies as an embedded OS, making option 1 correct. SUSE, CentOS, Debian, and Fedora are all examples of distributions intended mainly for use on desktop, laptop, and server computers; these do not qualify as embedded OSs, so options 2, 3, 4, and 5 are all incorrect.",,, 010-160,2,Which of the following is a notable difference between Linux and Mac OS X? ,Linux can run common GNU programs whereas OS X cannot.,Linux's GUI is based on the X Window System whereas OS X's is not.,Linux cannot run on Apple Macintosh hardware whereas OS X can run only on Apple hardware.,Linux relies heavily on BSD software whereas OS X uses no BSD software.,Linux supports text-mode commands but OS X is a GUI-only OS.,"Linux's GUI is based on the X Window System. Although OS X provides an X implementation, its primary GUI is Apple's proprietary product. Thus, option 2 is correct. Option 1 is incorrect because both Linux and OS X can run most GNU programs. Option 3 is incorrect because Linux can run on both Apple Macintosh and commodity PC hardware. Option 4 is incorrect because OS X includes many BSD utilities in its standard form. Furthermore, most Linux distributions use GNU utilities rather than their BSD equivalents, although you can use BSD utilities in Linux if you prefer. Option 5 is incorrect because both Linux and OS X support text-mode commands, although OS X makes it hard to use these commands in anything but its GUI Terminal application.",,, diff --git a/poc_standalone.py b/poc_standalone.py index d8deef0..4697b3f 100755 --- a/poc_standalone.py +++ b/poc_standalone.py @@ -43,11 +43,22 @@ def print_random_question(data): def _test_question(data): result = input("What's your answer? ") + if len(result) == 0: + return False if result in data["ANSWER"]: return True else: return False +def print_explication(data): + if not "EXPLICATION" in data.keys(): + return False + c = Console() + explication = "# {}".format(data["EXPLICATION"]) + explication = Markdown(explication) + c.print(explication) + + def _print_succes(status): c = Console() if status: @@ -74,6 +85,8 @@ if __name__ == "__main__": status = _test_question(question) counter.append(status) _print_succes(status) + if not status: + print_explication(question) print_stats(counter) except KeyboardInterrupt: print("byebye")