MCS 260 Project Two : a Quiz on Chinese/Japanese Numerals Due Monday 22 February at Noon
Total Page:16
File Type:pdf, Size:1020Kb
MCS 260 Project Two due Monday 22 February at noon Spring 2016 MCS 260 Project Two : a quiz on Chinese/Japanese numerals due Monday 22 February at noon The purpose of the the second project is to use dictionaries and list operations to make a simple quiz on the numerals in the Chinese and Japanese language. The unicode characters for the ten decimal numbers are in the following table: 1 一 'nu4e00' 2 二 'nu4e8c' 3 三 'nu4e09' 4 四 'nu56db' 5 五 'nu4e94' 6 m 'nu516d' 7 七 'nu4e03' 8 k 'nu516b' 9 ] 'nu4e5d' 10 A 'nu5341' The quiz starts by displaying a symbol and the user is prompted to supply the decimal value of the symbol. In case of a wrong answer, the user gets feedback as below: $ python numerals.py Welcome to our quiz on Chinese/Japanese numerals. What is the value of A ? 7 Wrong answer, A equals 10. $ If the answer to the first question is correct, then the quiz continues. In the second question, the user must give the position (starting the index count from zero) of the symbol that matches the value of the decimal number. In case the answer is wrong, feedback is given as below: $ python numerals.py Welcome to our quiz on Chinese/Japanese numerals. What is the value of 四 ? 4 Congratulations! Let us continue then, consider: ['一', 'A', 'm', '五', '七', 'k', '二', ']', '三', '四'] At which position is the value of 9 ? 5 Wrong answer, ] is at position 7. $ If the answer is correct, then the computer prints Congratulations! instead of the line that starts with Wrong answer. At the start of your program, import the following functions of the random module: from random import randint, shuffle Calling randint as randint(1, 10) returns a random integer number between 1 and 10, both 1 and 10 included. If L is a list, then shuffle(L) permutes the order of the elements in L, like in shuffling a deck of cards. UIC, Department of Mathematics, Statistics and Computer Science page 1 MCS 260 Project Two due Monday 22 February at noon Spring 2016 Some important points: 1. First and foremost, the Python interpreter must be able to execute your script. It is better to have a running but partial solution than a program that attempts to do all computations, but that fails to execute. Handing in an incomplete but working program is better than handing in a program that crashes or does not run at all. 2. The layout of the dialogue with the user and the formatting of the results should be exactly as in the example sessions. 3. Avoid grammatical and spelling errors in your dialogue with the user. 4. The first line of your Python program must be # MCS 260 Project Two by <Author> where you replace the <Author> by your name. 5. Add documentation to clarify your choice of variables and to indicate the steps of the program. 6. The computer project must be solved individually. Collaborations are not allowed. 7. Email your solution to the project to [email protected] before noon on Monday 22 February so the date of the email is proof of an on time submission. Bring also a printed version of your solution to class. If you have questions or difficulties with the project, feel free to come to my office for help. UIC, Department of Mathematics, Statistics and Computer Science page 2.