Python Tutorial
About Lesson

In this Python Number lesson we are going to talk about Creating Numbers in Python, so numbers are another type of built in data type in python and numbers are often useful in programming, for example if you want to keep the scores in a game. python treats numbers in several different ways, depending on how they’re being used.

 

now first let’s create examples on integer numbers.

In the above code we have just created a simple integer number of 50 and we stored the number in a variable of score after that we have printed the number.

 

 

Now we want to perform different arithmetic operations in Python Numbers, we want to add, subtract, multiply and divide numbers.

 

 

Run the code this is the result.

Python Number - Creating Numbers in Python
Python Number – Creating Numbers in Python

 

 

 

Also you can do arithmetic operations like this.

 

 

This is the result

Python Number
Python Number

 

 

 

Also if you are using two multiplication symbols, it will be represented as exponents.

 

 

 

 

Python supports order of operators. in the first example it will first multiply the two numbers and after that add the result with the 3. in the second example it will first remove the parenthesis and add the two numbers after that multiply the result with 2.

 

 

 

Python calls any number with a decimal point a float.

 

 

 

Doing arithmetic operations on floating numbers.

 

 

 

This is the result.

Creating Numbers in Python
Creating Numbers in Python
Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found