Skip to contentSkip to navigation

Core Data Types & Type Conversion

Learn Python's everyday types, int, float, str and bool, check a value's type with type(), and convert between them with int(), float(), str() and bool().
  • Module 1, lesson 4
  • About 8 minutes
  • Beginner friendly
  • 12-question quiz at the end

What you will learn

  • The four kinds
  • Check with type()
  • Convert text and numbers
  • Watch a type change

Four kinds of values

Every value in Python has a kind, called its type. The type decides what you can do with it.

Text in, number out

This line turns text into a number, then does maths with it. Tap each part to see its job.

Check and change types

Pick an example, change it, then press Run. Say what you expect to see before you press.

Watch a price change type

Press Step to run one line at a time. Watch the quotes appear and disappear in the names box.

Quick guesses

Guess first, then read why. A wrong guess is where the learning happens. Nothing here is scored.

Common type misconceptions

Each card is something beginners often believe. Tap it to see what Python really does.

Notes

Everything above, in words. Open it when you want the full explanation.

Syntax

The general shape of the statements in this lesson.

Worked examples

Read the problem, run the code, then read why it works.

Common pitfalls

Mistakes people make with this topic, and what to write instead.

In the real world

Where this shows up in software people use every day.

Key takeaways

Common questions

Guess the answer first, then open it.

Your notes

Sign in to keep private notes alongside this lesson.

Sign in to take notes

Where to go next

The quiz and the Lab live on their own pages, so this lesson stays about learning.

Finished this lesson?

Create an ID or sign in to save your progress across devices.

Create a free ID
Lessons done in this module0/4 complete

Quiz

Check what you learned

12 questions, with an explanation after every answer. A finished attempt is marked on the server and earns XP.

Lab

Keep going in the Lab

7 tasks on this lesson, from writing code to tracing it by hand. Practice only, no XP.

Review

Spaced review

Questions you miss in a quiz come back on a spaced schedule, so what you learned here sticks.

This lesson at a glance

The 6 lines of code this lesson uses, each with a short note. Keep it open while you do the quiz and the Lab.

What else you can search for and explore

Curious to go further? Each one opens a web search in a new tab.

References

Look things up here whenever you need the exact details.