0

I'm trying to write a code where I should have a few questions and an input for an answer. If the answer is correct, then it will tell me correct and wrong if it is wrong. I found a similar solution on this site, but the difference is that I need to use a dictionary. Heres a rough example of what is expected:

What is the French word for ‘one’? un

That is correct. You have 1 right and 0 wrong.

What is the French word for ‘two’? deux

That is correct. You have 2 right and 0 wrong.

What is the French word for ‘three’? trios

That is incorrect. The correct word is trois.

You have 2 right and one wrong.

I was assigned a random partner to work on this with, but he never did anything for it and I'm stuck doing it by myself. Help please?

Edit: if you come up with code for this, simple is better. We haven't studied that much stuff in class yet.

Edited by MTN: n/a

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by cghtkh
0

Start simple: write the code which indefinitely asks the user the French word for 'one' and always answers that is correct.

0

Here is something for you to start with

questions = [
                   ["What is the French word for one?", "un" ],
                   ["What is the French word for two?", "deux"],
                         ...
            ]
right = 0
wrong = 0
for question in questions:
    ans = raw_input(question[0])
    if ans.strip() == question[1]:
        ...
    else:
        ...
    print ...
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.