1. Python Introduction
1. Python Introduction
Python Installation
Variable in Python
Exchanging Ideas
Instructions
Computer
Result
Like Perl, Python source code is also available under the GNU
General Public License (GPL).
Why to Learn Python?
Python is Interpreted
Python is processed at runtime by the interpreter. You do not need to compile your program
before executing it. This is similar to PERL and PHP.
Python is Interactive
You can actually sit at a Python prompt and interact with the interpreter directly to write your
programs.
Python is Object-Oriented
Software Development
Mathematics
Data Analytics
Data Science
Python Installation
Step-1 Go to www.python.org
Step-2 Go to Downloads
https://www.jetbrains.com/pycharm/download/#section=windows
https://www.anaconda.com/products/individual
Variables in Python
Data/values can be stored in temporary storage spaces called variables.
What is
Variable
? name = “Amit”
age = 31
per = 89.60
Explain Variables in Python
student “Mike”
student “Shelly”
student “John”
Explain Variables in Python
Final Result
student “John”
Data Types in Python
Data type defines which type of data we want to store in variable.
Data-Types
20 20.52 “Amit”
True 5+3j
30452 3045.542 “Aman”
False Real + Imaginary
-21 -21.546 “Lalit”
Implementation Data Types in Python
User Choice input - int
User Choice input - float
User Choice input - str
Keywords in Python
Keywords are special reserved words in any programming language.
Literals in Python
Python Literals can be defined as data that is given in a variable.
Operators
+ - == != and = &
in is
/ * <= >= or += -= |
not in Is not
% > < not *= %= ^
Arithmetic Operators (+ , -, *, /, %)
Relational Operators ==, !=, <=, >=, >, <
Logical Operators (and, or, not)
Assignment Operators (=,+=, -=,*= ,%=)
Bitwise Operators (&, |, ^)
Complement(~) 13’s Comp= 00001101 And(&)
0=1 11110010 12=00001100
1=0 +1 13=00001101
11110011 00001100 = 12
Binary Format Or(|)
12 = 00001100 12=00001100
~12 = 11110011 Xor(^) 13=00001101
00 =0 00001101 = 13
2’s Complement 01= 1
Xor(^)
(1’s Complment+1) 10=1
12=00001100
11=0
13=00001101
00000001 = 1
Bitwise Operators (&, |, ^)
String Functions
Upper() Convert characters in capital letter