← Courses

Python for AI — Beginner Foundations

Data Science

Data Types · Lesson 29 of 76

Numbers

Python has two everyday number types: whole numbers (int) and decimals (float):

Python

Convert from text to a number when you need to do maths with it:

Python

Your turn: turn the string "3.14" into a float and double it.

Check your understanding

Exercise — check your understanding

Turn the text "3.14" into a float called pi, then set double to twice its value.

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →