PYTHON CORE PART PPT
PYTHON CORE PART PPT
Revanth reddy
CORE Submitted to : ER.Gaurav
pandey
PART ER.P.Stanley
2
INDUSTRIAL TRAINING
NAME : P.REVANTH
REDDY
ID : 21BTCSE020
COURSE : B.TEC.CSE
SUB CODE : CSIT 500
- 5th
semester
3
TOPICS OF PYTHON
• Introduction to Python
• Strings, Lists and Tuples
• Dictionaries and Sets
• Conditional Execution & Loops
• Comprehensions
• Functions
• Modules
• Scopes and Namespaces
4
WHAT IS PYTHON….?
HISTORY OF PYHON
• Python was conceived in the late 1980s by Guido van Rossum at Centrum Wiskunde & Informatica
(CWI) in the Netherlands as a successor to the ABC programming language, which was inspired by
SETL, capable of exception handling and interfacing with the Amoeba operating systems.
6
PYTHON FEATURES
• Interactive mode is where you type your code into the Python interpreter directly.
• This is useful for trying out small snippets of code, or for testing things out as you're
writing them.
• Functions can be used to allow for interactivity between your program and the user.
• The function input() displays a displays a desired string to the user and asks for an
input from them, while the function "print" displays a response.
• Functions can be used to allow for interactivity between your program and the user.
• The function input() displays a displays a desired string to the user and asks for an
input from them, while the function "print" displays a response.
8
PYYHON IDENTIFIERS
RULES
1. The identifier is a combination of character digits and underscore and the character includes
letters in lowercase (a-z), letters in uppercase (A-Z), digits (0-9), and an underscore (_).
2. An identifier cannot begin with a digit. If an identifier starts with a digit, it will give a Syntax
error.
3. In Python, keywords are the reserved names that are built-in to Python, so a keyword cannot
be used as an identifier - they have a special meaning and we cannot use them as identifier
names.
4. Special symbols like !, @, #, $, %, etc. are not allowed in identifiers.
5. Python identifiers cannot only contain digits.
6. There is no restriction on the length of identifiers.
7. Identifier names are case-sensitives
10
•abc123
•abc_de
•_abc
•ABC
•abc
•123abc
•abc@
•123
•for
11
PYTHON KEYWORDS
• Python Variable is containers that store values. Python is not “statically typed”. We do
not need to declare variables before using them or declare their type. A variable is
created the moment we first assign a value to it. A Python variable is a name given to a
memory location. It is the basic unit of storage in a program.
• Example of Variable in Python
• An Example of a Variable in Python is a representational name that serves as a pointer
to an object. Once an object is assigned to a variable, it can be referred to by that
name. In layman’s terms, we can say that Variable in Python is containers that store
values.
• Here we have stored “Geeksforgeeks” in a var which is variable, and when we call its
name the stored information will get printed.
14
BASIC OPERATORS
ARITHMETIC OPERATOR
Arithmetic operators are used with numeric values to perform common
mathematical operations:
COMPARISION OPERATORS
Comparison operators can compare numbers or strings and perform
evaluations.
Expressions that use comparison operators do not return a number
value as do arithmetic expressions.
Comparison expressions return either 1, which represents true, or 0,
which represents false.
These are typical comparisons:
•Are the terms equal? ( A = Z )
•Is the first term greater than the second? ( A > Z )
•Is the first term less than the second? ( A < Z )
For example, if A = 4 and Z = 3, then the results of the previous
comparison questions are:
•(A = Z) Does 4 = 3? 0 (False)
•(A > Z ) Is 4 > 3? 1 (True)
•(A < Z ) Is 4 < 3? 0 (False)
19
ASSIGNMENT OPERATORS
•basic assignment ( = )
•subtraction assignment ( -= )
•addition assignment ( += )
•division assignment ( /= )
•multiplication assignment ( *= )
•modulo assignment ( %= )
•bitwise XOR assignment ( ^= )
•bitwise OR assignment ( |= )
•bitwise AND assignment ( &= )
•bitwise right shift assignment ( >>= )
•bitwise left shift assignment ( <<= )
21
LOGICAL OPERATORS
Reverses a result, so
not not x if something is True ,
not turns it False
23
BITWISE OPERATORS
MEMBERSHIP OPERATORS
IDENTIFY OPERATORS
LOOP IN PYTHON
• Looping means repeating something over and over until a particular condition is
satisfied.
• A for loop in Python is a control flow statement that is used to repeatedly execute
a group of statements as long as the condition is satisfied. Such a type of
statement is also known as an iterative statement.
• There are 2 types of loops in Python:
• for loop
• while loop
30
31
FOR LOOP
WHILE LOOP
THANK YOU…..