Sunday, September 16, 2018

Python Ninja Bootcamp 4-Numbers

Learn Python like a Professional! Take You from 0 to Hero



In this Python lecture, we will learn about the Numbers.

Type of  Numbers 


There are three numeric types in Python
  • Integer
  • float
  • Complex
we focus on the Integer & floating point number.

Basic Arithmetic 


1. Addition

1 + 2
>>3


2 + 3
>>5


2. Subtraction


2 - 1
>>1


3 - 2
>>1


3. Multiplication



1 * 2
>>2


2 * 3
>>6


4. Division



2 / 5
>>0.4


5 / 7
>>0.7142857142857143


5. Power



2 ** 3
>>8


3 ** 4
>>81


6. Order of Operation



1 + 2 * 3
>>7


(1+2)*(3+4)
>>21


7. Assign Value



x=2
y=3


x
>>2


y
>>3


z=x+y


z
>>5


8. Rules for Python Variable Name
  • Must begin with a letter (a - z, A - B) or underscore (_)
  • Other characters can be letters, numbers or _
  • Case Sensitive
  • Can be any (reasonable) length
  • There are some reserved words which you cannot use as a variable name because Python uses them for other things.


principal=10


interest_rate=2


time=3


simple_interest=principal * interest_rate * time / 100


simple_interest
>>0.6

What is the importance of this lecture?

  • is the sign of addition.
  • -  is the sign of Subtraction.
  • is the sign of Multiplication.
  • is the sign of Division.
  • **  is the sign of Power.
  • Shift + Enter is used to run the code in jupyter notebook. 
  • TAB is used to Autocomplete in jupyter notebook.



EDITS ARE WELCOMED!!

In the next Blog, we will discuss Python String 

https://sngurukuls247.blogspot.com/2018/09/python-ninja-bootcamp-5-strings.html

......................................................................................................................................

Follow the link below to access Free Python Lectures-
https://www.youtube.com/channel/UCENc9qI7_r8KMf6-_1R1xnw

Instagram-
https://www.instagram.com/python.india/

View the Jupyter Notebook for this lecture

Download the Jupyter Notebook for this lecture 




Feel free contact me on-
Email - sn.gurukul24.7uk@gmail.com

No comments:

Post a Comment