RisingCoder Full course โ†’
Day 1Day 2Day 3Day 4
๐Ÿงฎ
FREE INTERACTIVE NOTES ยท DAY 3 OF 24

Math Powers & Truth Tests ๐Ÿงฎ

Bittu the robot is a lightning-fast calculator โ€” and today he also learns to answer True or False.

1The four everyday powers

๐Ÿค–
Bittu: I can do a billion of these per second. Your school calculator is shaking.
๐Ÿฆ‰
Professor Hoot: Notice 10 / 2 shows 5.0 not 5 โ€” division always answers with a decimal number (float).

2The three SECRET powers

๐Ÿ• Imagine 7 slices of pizza and 2 friends:

๐Ÿ
Py: // = how many whole slices each (3). % = slices left over (1). ** = power: 2**3 means 2ร—2ร—2 = 8.

The Remainder Machine ๐Ÿ• โ€” change the numbers!

slices for friends
7 // 2 = 3 each  ยท  7 % 2 = 1 left over

3Truth tests: True or False?

Bittu can compare things. The answer is always True or False โ€” nothing in between:

๐Ÿž
Bugly: Heheheโ€ฆ remember: = puts something in a box. == asks "are these equal?". Mix them up and I appear!

Truth slider: is x bigger than 50?

x = 30
x > 50  โ†’  False

4Joining tests: and / or / not

๐ŸŽข The rollercoaster rule: you can ride if you are 10 or older AND taller than 120 cm. Both must be True!

๐Ÿฆ‰
Professor Hoot: and = both must be True. or = any one is enough. not = flips the answer.

5Quick quiz! ๐Ÿง 

What is 9 % 4?
๐Ÿ’ก 9 shared by 4: two each (that's 8), and 1 left over. % gives the leftover.
What is True and False?
๐Ÿ’ก and needs BOTH to be True. One False spoils the party.

6Your mission ๐Ÿš€

Mission 1: You have โ‚น100. Momos cost โ‚น30 a plate. Use // to find how many plates you can buy, and % for the money left.
Mission 2: Print whether your age is greater than 10 โ€” let Python answer True or False.
Mission 3: Compute 2**10. That number is famous in computers โ€” you'll meet it again!

Day 3 complete! You speak True and False now. โšก

Tomorrow: teach Bittu to make decisions โ€” the superpower behind every game and app.

Go to Day 4: Decisions โ†’

๐ŸŽฎ Or test yourself in the free Python Arcade โ†’