This is the fifth attempt on the script. I managed to add in the percentage and a new statement called "elif". Elif statements is used for adding another condition. As you can see in the grade function. I changed the index<5 to len(QandAList). Len is the length of the list. It is used for lists to calculate length of the lists. So if I have 10 questions it will loop for 10 questions. It varies. I still haven't put in the float in my percentage. I ha problems with my "elif" statements, it just won't work well. So for the invalid selection to be valid, I had to type out elif(UserAns is "A") so on... It works! Thanks to my friend's help. ^^
My "numberofquestions" is not defined. And my invalid selection problem is still there... :(




No comments:
Post a Comment