Skip to content
Python Course #2: Data Types
Profile icon
SyrupPY

Python Course #2: Data Types

integers

You probably know about numbers. Numbers are integers like 5, 728, -98, -193 etc. Numbers are data types. A int is a integer/number.

floats

A float has a decimal point: 54.34 and -76.2. Floats are decimals. Floats are useful for trying to figuring out pi (3.14159265359). It's also useful for exact numbers. If you wanted to express the number between 3 and 4, you would want to write "3.5". Sorry fraction users, fractions are not used in python calculation, but you could convert decimals into fractions.

strings

str are "strings". Strings are words.
123abc is considered a str. As long as a data type has a word/letter, then it would be considered a string. Periods, Commas, Hyphens, Brackets, and etc. are all strings. You use strings all the time to communicate.

booleans

True and False are the only booleans. True is basically "yes", while False is "no". Booleans are used to answer questions such as Is 5 more than 2? if it is, then you would reply "True!", else reply "False".
Booleans are also 0s and 1s. Computers send information using 0s and 1s. In a picture 0 could mean white and 1 could mean black:

0110
1001
0101
except for the 0s and 1s are all in one line:

011010010101
To represent numbers, computers use base ten: Our Numbers: Binary Code: 0 0 1 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 9 1001 10 1010

That's all for today.

if you hadn't read the last tutorial, go to https://replit.com/talk/learn/PrintingCommenting-Python-Course-1/142824

You are viewing a single comment. View All
Profile icon
SyrupPY

@RtoonTV
No prob. :)