+30 XP
Lesson 14

Type Conversion

Change data types

transform

Transform Your Data!

Sometimes you need to change a string to a number, or vice versa!

Why convert types?

When you get input from users, it's always a string. But what if you want to do math?

age = input("How old are you?")
next_year = age + 1 # ERROR! Can't add string + number

idea Type conversion lets you change data from one type to another!