2. Numbers in Python
There are two major types of numbers in python: integer (whole numbers) and float (decimal numbers). You can play with the two data types In a Python, as follow:
1
23+54
2
>> 77
3
4
1.3+3.5
5
>> 4.8
6
7
1/2
8
>> 0.5
Copied!
Python ignore blank spaces when dealing with numbers. e.g. 23+54 and 23 + 54 are both OK.
You can also put numbers into variables (or placeholder of values), and perform operations on them.
1
X=4
2
X-3
3
>> 1
Copied!
Note that upper case and lower case matters in Python variable names (case-sensitive). e.g. Yandyare two different variables, and so areMyVariable and myvariable
Last modified 1yr ago
Copy link