Combining Comparisons Quiz

Combining Comparisons Quiz

This quiz is intended to test your knowledge of the contents covered in all the previous tutorials on conditionals, comparisons, and simple variables. In particular, it focuses on combining comparisons to make complex conditional statements as seen in Combining Comparisons in Ren’Py. Explanations are provided for each answer, and you can take the quiz as many times as you like.

It’s okay if you don’t know the answers to every quiz question, even after going through the tutorials. Some quiz questions are there to point out common errors or mistakes and teach you how to identify and fix them. If you don’t understand a question, feel free to skip it and read the explanation after submitting the quiz. There’s a free question box at the end of the quiz if you have any comments, questions, or feedback.

Question 1

Consider the following situation:

The player has three skills: intelligencestrength, and dexterity. If they pass a skill check for any of the three skills, they will successfully bypass a locked door. If none of their skills are high enough, they fail to unlock the door and receive the bad end. The player only has to bypass the door once (i.e. it wouldn’t make sense to unlock the door with the key and subsequently kick it down).

default intelligence = 0
default strength = 0
default dexterity = 0
label start():

    # Stats are set up here before the check

    if ((intelligence >= 5)
            and (strength < 5)
            and (dexterity < 5)):
        "You knew the forgetful lady who lived here would keep her key nearby."
        "You discovered the key in her potted plant and unlocked the door."

    if ((intelligence < 5)
            and (strength >= 5)
            and (dexterity < 5)):
        "With your superior strength, you kicked the door off its hinges to enter."

    if ((intelligence < 5)
            and (strength < 5)
            and (dexterity >= 5)):
        "Deftly, you procured a lockpick from your bag and proceeded to pick the lock on the door."
        "It swung open neatly before you, as if opened by a key."

    if ((intelligence < 5)
            and (strength < 5)
            and (dexterity < 5)):
        "Unfortunately, there was no way to open the door."
        jump bad_end


What combination(s) of values might cause an unintended result?


Question 2

Consider the following situation:

The player needs at least 5 points with a character in order to be contacted by them. Only one character should contact the player at this point.

default xia_points = 0
default ash_points = 0
default zoran_points = 0
label start():

    if xia_points >= 5:
        "Your phone rang. It was Xia."
    if ash_points >= 5 and xia_points < 5:
        "Your phone buzzed with a text message."
        "Ashwin wanted to know if they could swing by your house."
    if zoran_points >= 5 and xia_points < 5 and ash_points < 5:
        "A knock came from your front door."
        "Zoran" "It's me, Zoran!"
    if zoran_points < 5 and xia_points < 5 and ash_points < 5:
        "Tonight though, it looked like it would just be you and your pajamas."

What combination(s) of values might cause an unintended result?


Question 3

Consider the following code:

if gift == "camera" or "apron":
    # Statement 1
    "Ashwin" "I mean I appreciate you getting me the [gift],"
    "Ashwin" "But I don't think it's gonna help us out of this locked room."
elif gift == "hairpin":
    # Statement 2
    "Ashwin" "Hey wait, you got me a hairpin, didn't you?"
    "Ashwin" "Maybe I can try to pick the lock with it."
    # Statement 3
    "Ashwin" "I really don't know how we're going to get out of here."

The code above is run 4 times. The 1st time, gift = "camera", the 2nd, gift = "apron", the 3rd, gift = "hairpin", and the 4th, gift = "book".

In order, which statements will the player after the code has run 4 times as described above?

To mark your question correctly, please type just the numbers, separated by commas. e.g. 1, 2, 3, 4

Question 4

Currently, the line of code below would evaluate to False. You can add parentheses () to it to change the order of operations so it evaluates to True instead.

Where should the parentheses go in order to make the following line evaluate to True?

if not False and not True or False and True:

For the quiz to mark your answer as correct, copy out the line and paste it into the answer box below, then add your parentheses. Do not add any additional spaces or newlines to the code.

Hint: order of operations evaluates parentheses first, then not, then and, then or.

(Optional) Do you have any feedback on the lesson or the quiz?

Question 1 of 5

If you’d like to know more about the content covered in this quiz, see Combining Comparisons in Ren’Py, or start at the beginning with A Quick Primer on Variables in Ren’Py. If you’re feeling good about the content covered so far, then you’re ready to move on to Conditionals and Choice Menus in Ren’Py to learn how to add conditionals to choice menus!

Leave a Reply