My quiz is basically about random famous people and Sheel. In order to code the quiz, I had to use many of the syntaxes that I have learnt in the months so far.
Firstly, here is the link to the YouTube video which displays my final code for this quiz and the quiz being played. This video has no voice: https://youtu.be/Y9NLGp9bva4
After reading the post criteria again, I decided it was best to also include a video with audio: https://youtu.be/KIUK1_yaoFo
After reading the post criteria YET AGAIN, I decided it was best to ALSO include a Google Doc that houses only the code I had written. This way, it is easier to read rather than on the video: bit.ly/2gLHaNP
The purpose of this assignment was to be able to use all of the Python coding knowledge we have acquired so far to code our very own quiz for users to take. Before I actually started to code, I had to create a flowchart/mindmap to plan out what the structure of the code would look like. I did this on a sheet of paper and wrote it out in the pseudo code format. Later when I was actually coding the quiz on PyCharm, I actually found this flowchart to be very useful since it gave me a pretty thorough guideline which helped me to know what to code. However, I did decide not to include some elements from the pseudo code (such as the endgame response based on the score).
In the actual code itself, the main type of syntax that I used was ‘If’ and ‘Else’. I found this as the best type of syntax to use since in the quiz format, there is only one correct answer out of a, b, c, or d. Instead of writing separate responses for each of the 4 possible inputs, I decided that it was best to write a response for the correct answer and one for everything (and anything) else the user may have selected as an answer. Another element that I implemented throughout the code for my quiz was a score counter. My score counter was a variable which basically counts the number of questions that a user got correct. It did not subtract points if a user got a question incorrect. Once the user had completed the quiz, the computer would then tell the user their score. In order for the score counter to work, I needed to create it as a variable. This was actually the very first thing I did when coding this quiz. I defined the score counter as a variable called scorecounter and set it as zero. For every time a user got a question correct, the computer would print the ‘congratulations you got it right!’ response as well as add 1 point to the score counter variable. At the end of the game, the code prints out the total number of questions answered correctly by simply print(scorecounter). This way, the user can see how many questions they answered correctly. Apart from that, ‘If’ statements, ‘Else’ statements, and the score counters were basically the only special syntaxes that I included. I also used a different method to print on different lines which I will explain later on (since I got it from an internet source). In order to make sure that all of my code was working and to log all the modifications I made, I used a testing document. This testing document is where I logged all the elements that I had tested, what the element does, what modifications I made (if any), when it was tested, and by whom. This way, I could look at the spreadsheet at a glance to make sure everything worked instead of playing the quiz and reviewing the code line by line.
Overall, I think that my quiz was very successful. I was able to get the game completed, tested, and modified within the 3-4 class sessions given.
On this day, we were all told to simply create a pseudo code flow chart in order to brainstorm our quiz before we actually started to code it out on PyCharm. I spent this class period finishing my flow chart (image inserted above). I had some time after I completed my flowchart (since I finished early) which I used to actually start coding on PyCharm. Since there actually wasn’t that much time (maybe 10-15 mins), this is all that I had completed by the end of the class:
This is the class period where I got the most work done. I basically spent this whole period writing up the code for all 16 of the questions. By the end of this class, I had actually completed the first draft of my quiz. Since it is so long, I’m not going to insert a screenshot. The videos linked above basically show the quantity of code I completed during this lesson.
This is the class where the testing document was introduced to us. Prior to working on the testing document, I made some minor tweaks here and there in the code to make it run more efficiently. Afterwards, I created and started filling out the testing document (linked above)
During this project, there were some obstacles that I had to overcome. The actual only issue that I ran into that I couldn’t solve on my own without the internet was learning how to print on different lines. Despite the fact that Ms. Mok had showed us how to do this previously, I had forgotten how to and therefor had to use the internet to search up how. In the end, I found 3 website links (same website, but 3 different forums). I tried all of the methods, but only found the last link to be useful. I used the syntax listed in the last forum in my code: http://stackoverflow.com/questions/25676970/print-multiple-lines-in-one-statement-without-leading-spaces http://stackoverflow.com/questions/19941141/printing-each-item-of-a-variable-on-a-separate-line-in-python http://stackoverflow.com/questions/13443588/how-can-i-format-a-list-to-print-each-element-on-a-separate-line-in-python In the end, I used the information that I gathered on the web to actually print on separate lines. Here is the syntax I used and the result it yielded:
To conclude, I found this to be a rather interesting summative task. Through this project, I was able to bring together most of what I have learnt so far and use it to create a quiz on a topic that I found interesting. This project also helped me to realize what real life coders use their skills to produce (such as a quiz!)