Store the Options
Exit

Store the Options

Store each answer option in its own variable

💻

Writing code and entering commands is only available on desktop. Open this page on a larger screen to complete this chapter.

The question is now in a variable, but the four answer options are still hardcoded in the print() calls. Like the question, they belong in variables — so you can reuse them and change them in one place.

Strings need quotes

When you assign a string variable, the value must be in quotes:

season = "autumn"

The quotes are what make it a string. Without them, Python looks for a variable named autumn — which doesn't exist.

This matters for your options because they happen to look like Python keywords. "float" (with quotes) is the string "float" — just text. Without quotes, float is a Python built-in. Always use quotes when you mean the text.

Generic example

direction_1 = "north"
direction_2 = "south"
direction_3 = "east"
direction_4 = "west"

You'll follow the same pattern for the quiz options.

Note: the print() statements still use hardcoded text for now. That changes in the next chapter — once you have the variables, you'll wire them into the display.

Instructions

Store the four answer options as variables — once they have names, the display can reference them instead of duplicating the text each time.

  1. Create a variable named option_1 and assign it the string "int".
  2. Create a variable named option_2 and assign it the string "str".
  3. Create a variable named option_3 and assign it the string "float".
  4. Create a variable named option_4 and assign it the string "bool".