Develop: quiz.py

There needs to be a global variable in order for this program to work since the variable that keeps track of the number of questions the user gets right, SCORE, is used in more than one function. Unless SCORE is declared as a global variable, it defaults to being a local variable, where it can only exist either within the main code of the program or only within the programmer-defined function. By declaring SCORE as a global variable, we can now use SCORE both within the main code of the program and within the programmer-defined function.

I will use multiple .py files to keep my code organized. I will split my program up into 3 .py files named quizFC.py, quizFC_data.py, and quizFC_functions.py. In quizFC_data.py, I will store all the variables that the program will need to run. In quizFC_functions.py, I will have all the programmer-defined functions stored. Finally, quizFC.py will be where I call the programmer-defined functions and introduce the program to the user.

 

Leave a comment