Lab Notebook Week 4
Updated Quiz with dictonaries and while loop
- Dictonaries
To condence the code and to make it more readable, I organized the code so that all of the questions are in a single dictonary and all the answers are in another dictonary
- To check if the input is correct:
the code looks for the input inside a specific list inside the “answer” dictonary.
” if rsp in Answers[str(q)]: “
- To print the questions/promt:
question[“quest”][q]
the questions dictonary is really just a single string
q is a varible contaning a number and that is used to pull the corrosponding thing from the list
- While loop
- “while q <6:” the while loops loops until the conditions becomes false.