Machine Learning Tutorial Python : 6. Python Number and Arithmetic Operators

Pubblicato il: 08 gennaio 2019
sul canale di: Vinoth QA Academy
1,485
16

#vision2020 #aiforeveryone #pythonnumpy :

"My Vision is to provide "AIFOREVERYONE", by creating free video courses for Artificial Intelligence ,
Machine Learning, Deep Learning and Data Science Aspirants!"

If you wish to support my #vision2020, kindly Like, Subscribe & Share this knowledge to your friends and colleagues.

Follow Me :

Materials: https://aiforevery1.com/numpy/

Udemy : https://www.udemy.com/user/vinoth-rat...

LinkedIn :   / vinothrathinamautomation  

Facebook :   / aiforevery1  

Github : https://github.com/vinothrwins

************************************************************
Playlist:

Artificial Intelligence for Beginners :    • Playlist  

Python for Artificial Intelligence :    • Python for Artificial Intelligence(Data Sc...  

Mathematics for Artificial Intelligence :    • Mathematics for Artificial Intelligence  

Python NumPy for Artificial Intelligence :    • Python NumPy for Artificial Intelligence  

Data Science Process :    • Playlist  

***********************************************************
Python for Beginners - This video explains about the Python Number and Arithmetic Operators

Note: Use HD view for clear text visible
*****************************************
Agenda :

What is Data Type?
Types of Data Types
Types of Python Numbers
Identifying the Variable Types
What are Operators in Python?
Types of Operator
Arthimetic Operators
Rule of Precedence in Python

*****************************************
What is Data Type?

It is an attribute that tells what kind of data that value or a variable can have it.
Example:
rollnumber = 12345 # rollnumber is integer
name = "Anand" # name is string
marks = 80.5 # marks is float

*****************************************
Standard Data Types

Python has five standard data types −
1. Numbers
2. String
3. List
4. Tuple
5. Dictionary
*****************************************
Python Numbers

Python support 3 different numerical types :

1. Integer
2. Float
3. Complex Number

i = 50 # Number without decimal point - Integer
f = 3.14 # Number with decimal point - Float
x = 2 + 3j # Number consists of both real and imaginary value - Complex Number
print(i,f,x)
*****************************************
Identifying the Variable Types

type()- inbuilt function which is used to determine the type of the variable.

print(type(i))
print(type(f))
print(type(x))

class 'int'
class 'float'
class 'complex'
*****************************************
What are Operators in Python?

Operators are special symbols in Python that carry out arithmetic or logical computation. The value that the operator operates on is called the operand.

Example :
10 + 5 = 15.
Here, + is the operator that performs addition. 10 and 5 are the operands and 15 is the output of the operation.
*****************************************
Types of Operator

Python language supports the following types of operators.

1. Arithmetic Operators
2. Comparison (Relational) Operators
3. Assignment Operators
4. Logical Operators
5. Bitwise Operators
6. Membership Operators
7. Identity Operators

Let us have a look on all operators one by one.
*****************************************
Arthimetic Operators

Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication etc.

Sample Code

x = 20
y = 5

Addition Operator
print('Addition of x + y =',x+y)

Subtraction Operator
print('Subtraction of x - y =',x-y)

Multiplication Operator
print('Multiplication of x * y =',x*y)

Addition of x + y = 25
Subtraction of x - y = 15
Multiplication of x * y = 100

Note: While multiplying Integer and Float value, the result will be a float value.

j= 3 * 1.5
print(j)
print(type(j))

4.5
class 'float'

x = 10
y = 3

Float Division Operator
print('Float Division of x / y =',x/y)

Integer Division Operator
print('Integer Division of x//y =',x//y)

Integer Division for Negative Value
print('Integer Division of Negative Numbers =',-10//3)

x = 10
y = 3

Float Division Operator
print('Float Division of x / y =',x/y)

Integer Division Operator
print('Integer Division of x//y =',x//y)

Integer Division for Negative Value
print('Integer Division of Negative Numbers =',-10//3)

Modulus or Remainder Operator

x = 5
y = 2
print('Modulus of x%y =',x%y)

Modulus of x%y = 1

Exponentiation Operator

x = 4
y = 2

print('Exponentiation of x raise to the power y =',x**y)

Exponentiation of x raise to the power y = 16
*****************************************
Kindly let me know your feedback for improvement purpose. Feel free to correct any mistakes in case !!

Happy Learning,
Vinoth Rathinam


In questa pagina del sito puoi guardare il video online Machine Learning Tutorial Python : 6. Python Number and Arithmetic Operators della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Vinoth QA Academy 08 gennaio 2019, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,485 volte e gli è piaciuto 16 spettatori. Buona visione!