0% found this document useful (0 votes)
24 views

Python Programming

The document discusses Python programming including introduction to Python, variables, data types, operations, loops and functions. It explains that Python is a popular programming language created in 1991. Variables in Python don't require data type declaration. Python has built-in data structures like lists, dictionaries, tuples and sets. The document also covers arithmetic, assignment, comparison, logical and other operators in Python.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Python Programming

The document discusses Python programming including introduction to Python, variables, data types, operations, loops and functions. It explains that Python is a popular programming language created in 1991. Variables in Python don't require data type declaration. Python has built-in data structures like lists, dictionaries, tuples and sets. The document also covers arithmetic, assignment, comparison, logical and other operators in Python.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Jb Institute of technology

Python
programming

Submitted by –
Divyanshi Agarwal
Btech cse 2nd year
Lets learn about python programming!!!

 Introduction to Python
 Using variables in Python
 Basics of Python Programming
 Datatypes in python
 Operations in Python
 Loops in Python
 Functions in Python
INTRODUCTION TO PYTHON

 PYTHON is a popular programming language. It was created by Guido van


Rossum, and released in 1991and further developed by the Python Software
Foundation. It was designed with an emphasis on code readability, and its
syntax allows programmers to express their concepts in fewer lines of code.
 Python is a high-level, general-purpose and a very popular programming
language. Python programming language (latest Python 3) is being used in web
development, Machine Learning applications, along with all cutting edge
technology in Software Industry.
 Python is a programming language that lets you work quickly and
integrate systems more efficiently.
 There are two major Python versions: Python 2 and Python 3.
Both are quite different.
For example:-

# To print hello world:-

#output:-
Introduction and Setup

1. If you are on Windows OS download


Python by Clicking here and now install from
the setup and in the start menu type
IDLE.IDLE, you can think it as a Python’s IDE
to run the Python Scripts. It will look somehow
this :
2.If you are on Linux/Unix-like just open the terminal and on 99% linux OS
Python comes preinstalled with the OS.Just type ‘python3’ in terminal and you
are ready to go. It will look like this :
Variables and data structure in python
 In other programming languages like C, C++, and Java, you will need to declare the type of variables but
in Python you don’t need to do that. Just type in the variable and when values will be given to it, then it
will automatically know whether the value given would be an int, float, or char or even a String.
 See, how simple is it, just create a variable and assign it any value you want and then use the print function
to print it. Python have 4 types of built-in Data Structures namely List, Dictionary, Tuple, and Set.
 List is the most basic Data Structure in python. List is a mutable data structure i.e items can be added to
list later after the list creation. It’s like you are going to shop at the local market and made a list of some
items and later on you can add more and more items to the list.
BASICS OF PYTHON
PROGRAMMING
 What Are Variables In Python?
 Variables and data types in python as the name suggests are
the values that vary. In a programming language, a variable is a
memory location where you store a value. The value that you
have stored may change in the future according to the
specifications.
 What are constants in Python?
 Constants are literals which contain a value which is not supposed to
be changed during the execution of the program.
DATA TYPES
Operators in Python
 Python divides the operators in the following groups:
• Arithmetic operators
• Assignment operators
• Comparison operators
• Logical operators
• Identity operators
• Membership operators
• Bitwise operators
LOOPS IN PYTHON

 Python provides three ways for executing the loops.


While all the ways provide similar basic functionality,
they differ in their syntax and condition checking time .
o WHILE LOOP
o FOR LOOP
WHILE LOOP
While Loop in Python
In python, a while loop is used to execute a block of statements
repeatedly until a given condition is satisfied. And when the condition
becomes false, the line immediately after the loop in the
program is executed.
Syntax :
while expression: statement(s)
FOR LOOP
For Loop in Python
For loops are used for sequential traversal.
For example: traversing a list or string or array etc.
In Python, there is no C style for loop, i.e., for (i=0; i<n; i++).
There is “for in” loop which is similar to for each loop in other
languages.
Let us learn how to use for in loop for sequential traversals.
Syntax:
for iterator_var in sequence: statements(s)
FUNCTIONS IN PYTHON
 A function is a block of code which only runs when it is called.
 You can pass data, known as parameters, into a function.
 A function can return data as a result.
CALLING BY A
FUNCTION
To call a function, use the function name followed by parenthesis:
Example:
def my_function():
print("Hello from a function")

my_function()
OUTPUT:

Hello from a functiona function lo from a function


PYTHON APPLICATIONS
Thank you!!!

You might also like