Tuesday, 3 December 2013

Second Attempt: Introducing lists and index!


Screenshot sucks! But never-mind. :) Let's go on to my second progress on my script. This time round there was a big change in my script. >.< I changed to a brand new format. This time, I added grade and percentage functions with parameters. However, this script cannot be run. :(

The following is the F5 module of my script:
As you can see, there was an error in my program: "unindent does not match any outer indentation level". At this point, I took quite some time to think about it... 

There is something wrong with my spacing behind the "if" statement but I did not know what went wrong. So I was kind of frustrated. >.< 

Anyway, for this script, I added lists of options. For example:

OptList = ["A. Purple Orchid\t B. Miss Vanda Jouqium\t C. Vanda Miss Joaqium\t D.  Vanda Miss Joaquim","A. Forever\t B. 4\tC. 12\tD. 3","A. Primates\t B. Dolphins\t C. Elephants\t D. Canines","A. Canada\t B. Ukraine\t C. Norway\t D. Vatican City","A. 20\tB. 24\tC. 0\tD. 14"]

The "/t" is to make the options arrangement to be in this format:
1. What is the full name of the national flower in Singapore?
A. Purple Orchid
B. Miss Vanda Jouqium
C. Vanda Miss Joaqium
D. Vanda Miss Joaquim

See, it prints out nicely!

The next thing that I changed was the index an score. To make the script run, I changed the index = 0 first. And after a question is asked and answered correctly, I included index += 1 below so that it actually goes to the other question. If it's wrong, question will be asked again. (there will be no index += under the else statement. At this stage, I was still not introduced to "while" or "for" loops yet, so I was stuck with the basic one.



No comments:

Post a Comment