🐸

The Gatekeeper

Python Basicspython-basics-09-the-gatekeeper
Reward: 70 XP
|

The Gatekeeper

A tall stone golem blocks the path. "Only those with enough power may pass," it rumbles.

To answer the golem, you need to compare your power level with his requirement.

Comparison Spells

print(5 > 3)   # True (5 is greater than 3)
print(2 < 10)  # True (2 is less than 10)
print(5 == 5)  # True (5 is equal to 5)
print(5 == 3)  # False (5 is NOT equal to 3)

These operators give you a True or False answer.

Your Mission

1
Power Check

Create a variable my_power and set it to 10.

2
The Challenge

Create a variable golem_power and set it to 8.

3
The Comparison

Print the result of my_power > golem_power.

4
Equality Check

Print the result of my_power == 10 to confirm your strength.

Equals vs Assignment

Remember: = is for putting things in boxes (assignment). == is for comparing things (equality).

Suggested Solution
Click to expand

Here is how you face the Gatekeeper:

my_power = 10
golem_power = 8
print(my_power > golem_power)
print(my_power == 10)
Advanced Tips
Want more? Click to expand

There are more ways to compare!

print(5 >= 5)  # True (Greater than OR equal to)
print(3 <= 4)  # True (Less than OR equal to)
print(5 != 3)  # True (Not equal to)

!= means "not equal". It returns True if the values are different.

pymain.py
Loading...
Terminal
Terminal
Ready to run...