Basic
PYTHON 101 By muhammad amin
https://github.com/mhmmdmin/Portfolio
welcome to
BASIC PYTHON 101
Python is an interpreted, object-oriented, high-level programming language with dynamic
semantics. Its high-level built in data structures, combined with dynamic typing and
dynamic binding, make it very attractive for Rapid Application Development, as well as for
use as a scripting or glue language to connect existing components together.
Page 02 of 15
table of
CONTENT
Data types arithmetic operator variables
assignment operator comparison operators logical Operators
Page 03 of 15
data types Page 04 of 15
introducing
DATA TYPES numeric
source: geekforgeeks.org
Data type acts as the structure of the Sequence Type
programming language which is
needed to construct the idea and to
boolean
communicate with the computer to
create a meaningful communication.
The point is, if we don't know the data set
types, we can't communicate with the
computer effectively.
dictionary
numeric types Page 05 of 15
INTEGER FLOAT COMPLEX
A whole number; a A float is a floating-point Complex number is
number that is not a number, which means it is a represented by complex class.
fraction. number that has a decimal It is specified as (real part) +
place. (imaginary part).
- 5 , 1 , 1 0 0 0 . 2 5 , 3 0 . 3 2 + 3 y
sequence type Page 06 of 15
SEQUENCE TYPE
STRING LIST TUPLE
" string " [ list ] ( tuple )
A string is a collection of one or Lists are just like the arrays, Just like list, tuple is also an ordered
more characters put in a single declared in other languages which collection of Python objects. The only
quote, double-quote or triple is a ordered collection of data. It is difference between tuple and list is
quote. very flexible as the items in a list that tuples are immutable i.e. tuples
do not need to be of the same cannot be modified after it is
type. created.
boolean
IS IT TRUE?
IS IT FALSE? Data type with one of the two built-in
values, True or False. Boolean objects that
are equal to True are truthy (true), and
those equal to False are falsy (false). It is
denoted by the class bool.
Page 08 of 15
Set HOW TO CREATE
TYPES SET
In Python, Set is an unordered collection of
data type that is iterable, mutable and has
no duplicate elements. The order of elements
in a set is undefined though it may consist of
various elements. So in set, if you input same
element, only one element that appear in the
output.
SET(VALUE)
GRAPHIC DESIGNER PHOTOGRAPHER
Page 09 of 15
ictionary
D
TYPES CREATE
Dictionary in Python is an unordered
collection of data values, used to store data
DICTIONARY
values like a map, which unlike other Data
Types that hold only single value as an
element, Dictionary holds key:value pair. Key-
USING CURLY {}
value is provided in the dictionary to make it
more optimized. Each key-value pair in a
Dictionary is separated by a colon :, whereas
GRAPHIC DESIGNER
BRACES
PHOTOGRAPHER
each key is separated by a ‘comma’.
introducing operators Page 10 of 15
addition = +
subtraction = -
source: geekforgeeks.org
arithmetic multiplication = *
OPERATORS
Arithmetic operators are used with
division = /
numeric values to perform common
modulus = %
mathematical operations
exponentiation = **
floor division = //
variables Page 11 of 15
Variables
IN PYTHON
In Python, variables are a symbolic name that is a reference or pointer to an object.
use ordi nary letters no spaces!! use underscore
ordi nary number no reserved words!! to separate words
assignment operators Page 12 of 15
assignment
OPERATORS
The assignment operator =
assigns the value of its right-
most common used assignment operators
hand operand to a variable, a
property, or an indexer element
given by its left-hand operand.
comparison
Comparison
OPERATORS
In Python, comparison operators is used to compare two values.
equal to ( == ) not equal to ( != ) greater than ( > )
less than ( < ) greater than or equal to ( >= ) less than or equal to ( <= )
Page 13 of 15
logical Page 14 of 15
Logical
OPERATORS
Logical operators are used to combine conditional statements:
Not or
And
Reverse the result, Returns True if one
Returns True if both
returns False i f the of the statements is
statements are true
result i s true true
Page 15 of 15
Thank You
connections!
[email protected] https://github.com/mhmmdmin