PYTHON LESSON

Topic 3/63 · Phase 1: Foundations

Data Types — Python lesson on EduBard (phase: Foundations)

Data Types

Main idea

Python tracks the type of each value to choose valid operations.

Tip

Use type() while learning.

Watch out

Treating strings as numbers.

Read this next

This lesson is about Data Types. You are in the Foundations part of the course.

Main idea:
Python tracks the type of each value to choose valid operations.

How to learn it: type a very small program first. Run it. Change one line and run again.

Tip:
Use type() while learning.

Common mistake:
Treating strings as numbers.

Your challenge:
Create int, float, str, and bool values and print each type.

Scroll down to the challenge lab. Run your code there. When the output meets the task and the checks pass, press the green button to finish this topic.

Example code

Copy this example if it helps. Change it so it matches Data Types.

# Topic: Data Types
def main():
    sample = "edit me"
    # TODO: apply Data Types concept here
    result = sample
    print("Result:", result)

if __name__ == "__main__":
    main()

Challenge

Create int, float, str, and bool values and print each type.

Before you can finish: your output should include at least 14 characters; at least 1 non-empty line(s); must contain (letters can be upper or lower case): "<class"; no crash traceback—fix errors until the program runs cleanly.

Use Run. Read the output. Change your code until the task is done.

Starter reference

# Challenge starter for Data Types
def solve():
    # Write your solution here
    pass

print("Update solve() and run")

Your code

The first Run may load Python in your browser (one-time). Later runs are faster.



    
    

Navigation