Glow Up Your Python: Data Types & Operators!

Python: Data Types & Operators

1 / 13
volgende
Slide 1: Slide
newEditor

In deze les zitten 13 slides, met interactieve quizzen en tekstslides.

Dit is niet oké

Onderdelen in deze les

Python: Data Types & Operators

What do you already know about data types and operators in Python?

At the end of the lesson you will:

◘ Know 4 main Python data types,

◘ Use math operators,

◘ Write code with true/false comparisons.

◘ Get ready75% coding in class!

Today's Mission

1. Use int, float, str, bool. 2. Try math operators. 3. Compare values with code. Class = You coding!

Four Core Data Types

Q: What type is "Hello"? A: str Options: int, float, str, bool.

Quiz Time!

int: Whole numbers. age = 14 30a float: Decimals. price = 3.99 4ac str: Text. name = "Claude" 539 bool: True/False. logged_in = True

Examples

Math Operators

`+`: 5+3=8

`-`: 9-4=5 `*`: 3*4=12

`/`: 10/2=5.0 `%`: 10%3=1 (Remainder `**`: 2**3=8 (Power)

Comparison Operators

True or False? Check values! == Equal: 5==5 != Not equal: 5!=3 > Greater: 7>4 < Less: 2<9

6a0 Golden Rule!

= : STORE value. score = 10 == : CHECK value. score == 10 Q: What is the difference between = and ==?

4bb Activity Time 28 40 mins 29

  • Open your Python IDE -

  • Complete Missions 1, 2, 3 -

  • Ask for help if stuck over 3 mins! [Timer: 40:00]

3af Exit Ticket

Q3: Why does age = input(); print(age+5) crash?

Quick Quiz

Open Question

Q1: What type is 3.14? Options: int, float, str, bool. Q2: What is 15 % 4? Options: 3, 3.75, 4, 15.

Write down 3 things you learned in this lesson.

Write down 2 things you want to know more about.

Ask 1 question about something you haven't quite understood yet.