Numbers and Booleans
Written by
Numbers:
Number Data types in Python can be broadly divided into Integers and Floats or Floating point values. An integer has no decimal in it, whereas a floating point number can display digits past the decimal point.
These are very basic data types in Python. An important point to note is that Python 3 performs true division by default, so 1/2 will be printed as 0.5 and not 0. (No rounding up takes place, as explained in the previous tutorials).
Booleans:
Boolean Data type conveys whether a given statement is True or False. It is used a lot in programming, and plays a key role.
We can assign a boolean value to a variable as follows-
var_=True
print(var_)
var_=False
print(var_)
And we will get the following output-
True
False
Boolean values are mostly used as flags – Flags basically act as a signal for a function or a process, like when to get out of a loop or when to assign a particular variable a particular value (when you practice later on, you will understand what I am trying to say), etc.
They are also used a lot as conditions in conditional statements ( we will see what these are later on, just remember this fact).
Lists:
I have made these two tutorials on basics of lists –
https://www.studymite.com/python/list-in-python/
https://www.studymite.com/python/list-properties-and-methods-in-python/
After this, we will move onto strings, which are just lists of characters.