Basics · Lesson 4 of 27
Data types
Every value in Python has a type. The four basic ones:
int: whole numbers like10,-3,0float: decimal numbers like99.5,3.14str: text in quotes like"pen",'42'bool: onlyTrueorFalse(capital T and F)
Use type() to see a value's type:
print(type(10)) # <class 'int'>
print(type(99.5)) # <class 'float'>
print(type("pen")) # <class 'str'>
print(type(True)) # <class 'bool'>"42" with quotes is a string, not a number. 42 without quotes is an int.
Your task
Create these four variables:
countwith the whole number10pricewith the decimal number99.5itemwith the textpenin_stockwith the valueTrue