0% found this document useful (0 votes)
143 views32 pages

PYTHON CORE PART PPT

Uploaded by

21btcse016
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views32 pages

PYTHON CORE PART PPT

Uploaded by

21btcse016
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

PYTHON Submitted by : P.

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

Python Fundamentals and Programming

• Introduction to Python
• Strings, Lists and Tuples
• Dictionaries and Sets
• Conditional Execution & Loops
• Comprehensions
• Functions
• Modules
• Scopes and Namespaces
4

WHAT IS PYTHON….?

• 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. Python's simple, easy to learn syntax emphasizes readability and therefore
reduces the cost of program maintenance. Python supports modules and packages,
which encourages program modularity and code reuse. The Python interpreter and the
extensive standard library are available in source or binary form without charge for all
major platforms, and can be freely distributed.
5

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

• Free and Open Source. ...


• Easy to code. ...
• Easy to Read. ...
• Object-Oriented Language. ...
• GUI Programming Support. ...
• High-Level Language. ...
• Large Community Support. ...
• Easy to Debug.
7

INTERACTIVE MODE PROGRAM

• 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

SCRIPT MODE PROGRAMMING

* Python has two basic modes: script and interactive.


* The normal mode is the mode where the scripted and finished .
* python files are run in the Python interpreter.
* Interactive mode is a command line shell which gives immediate feedback for each
statement,
while running previously fed statements in active memory.
9

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

Python Valid Identifiers Example

•abc123
•abc_de
•_abc
•ABC
•abc

Python Invalid Identifiers Example

•123abc
•abc@
•123
•for
11

PYTHON KEYWORDS

• Python keywords are special reserved words that have


specific meanings and purposes and can't be used for
anything but those specific purposes. These keywords are
always available—you'll never have to import them into
your code. Python keywords are different from Python's
built-in functions and types.
12
13

VARIABLE TYPES IN PYTHON

• 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

Python Variable Types


•Integer. A Python integer or int refers to whole numbers that
can be either positive or negative. ...
•Float. A Python float variable allows you to store decimals or
floating-point values. ...
•String. A string variable in Python allows us to store letters,
words, or sentences. ...
•Boolean. ...
•List. ...
•Dictionary. ...
•Tuple. ...
•Set.
15
16

BASIC OPERATORS

• Python divides the operators in the following groups:


• Arithmetic operators.
• Assignment operators.
• Comparison operators.
• Logical operators.
• Identity operators.
• Membership operators.
• Bitwise operators.
17

ARITHMETIC OPERATOR
Arithmetic operators are used with numeric values to perform common
mathematical operations:

Operator Name Example


+ Addition x+y
- Subtraction x-y
* Multiplication x*y
/ Division x/y
% Modulus x%y
** Exponentiation x ** y
// Floor division x // y
18

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

• The assignment operator = assigns the value of its right-


hand operand to a variable, a property, or an indexer
element given by its left-hand operand.
• The result of an assignment expression is the value
assigned to the left-hand operand.
20

Types of Assignment Operators in C

An assignment operator is basically a binary operator that helps in


modifying the variable to its left with the use of the value to its right. We
utilize the assignment operators to transform and assign values to any
variables.
Here is a list of the assignment operators that you can find in the C
language:

•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

• A logical operator is a symbol or word used to


connect two or more expressions such that the value
of the compound expression produced depends only
on that of the original expressions and on the
meaning of the operator. Common logical operators
include AND, OR, and NOT.
22

Operator Syntax Description

This returns True if


and x and y
both x and y are true

This returns True if


or x or y
either x or y are true

Reverses a result, so
not not x if something is True ,
not turns it False
23

BITWISE OPERATORS

• Python bitwise operators are used to perform bitwise


calculations on integers.
• The integers are converted into binary format and then
operations are performed bit by bit, hence the name bitwise
operators.
• Python bitwise operators work on integers only and the final
output is returned in the decimal format.
24
25

MEMBERSHIP OPERATORS

Membership operators are used to test if a sequence is presented in an object:

Operator Description Example Try it

in Returns True if a x in y Try it »


sequence with the
specified value is
present in the object
not in Returns True if a x not in y Try it »
sequence with the
specified value is not
present in the object
26

IDENTIFY OPERATORS

• Identity operators are used to compare the objects if both the


objects are actually of the same data type and share the same
memory location.
• There are different identity operators such as. 'is' operator –
Evaluates to True if the variables on either side of the
operator point to the same object and false otherwise.
27

FLOW CONTROL STATEMENT

• The statements inside your source files are generally


executed from top to bottom, in the order that they
appear.
• Control flow statements, however, break up the flow of
execution by employing decision making, looping, and
branching, enabling your program to conditionally
execute particular blocks of code.
28
29

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

For loop is used when the number of iterations is already known.

WHILE LOOP

While loop is used when the number of iterations is already


Unknown. In the while loop, it can be repeated at every
iteration.
32

THANK YOU…..

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy