Unit 1- 1.1 python.pptx for also python you

bagga26085 2 views 33 slides Oct 29, 2025
Slide 1
Slide 1 of 33
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33

About This Presentation

It iss for python


Slide Content

UNIVERSITY INSTITUTE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING PYTHON PROGRAMMING ( 24CSP-203 ) Unit No. 1 Chapter No. 1.1 Lecture No. 1 Topic : Basics of Python Programming Academic Session 2025-26 ODD Semester Jul-Dec 2025 Dr. Gitanjali – E16525 Assistant Professor

Learning Objectives Understand the purpose and features of Python as a programming language. Write and execute basic Python programs using correct syntax and indentation. Identify and apply various Python data types (int, float, str, bool, etc.). Utilize built-in functions like print(), type(), id(), and range(). 1 Dr. Gitanjali – E16525 Assistant Professor

Topics Covered Writing simple Python programs Python basic data types: int , float, complex, bool , str Declaring and using variables Built-in functions: id(), type(), range() 2 Dr. Gitanjali – E16525 Assistant Professor

Introduction to Python What is Python? Python is a high-level, interpreted, and general-purpose programming language. It was created by Guido van Rossum and released in 1991. Known for its simple and readable syntax, making it beginner-friendly. 3 Dr. Gitanjali – E16525 Assistant Professor

Introduction to Python Key Features of Python Easy to Learn & Use – Uses English-like syntax (e.g., print("Hello, World!")). Interpreted Language – No need for compilation, executes line by line. Dynamically Typed – No need to declare variable types (x = 10 works directly). 4 Dr. Gitanjali – E16525 Assistant Professor

Introduction to Python Hello World in Python print() is a built-in function to display output. " Hello, World! " is a string that gets printed. 5 Dr. Gitanjali – E16525 Assistant Professor

Introduction to Python Why Learn Python? Python works on different platforms (Windows, Mac, Linux, etc ). Python has a simple syntax similar to the English language. Python has syntax that allows developers to write programs with fewer lines than some other programming languages. 6 Dr. Gitanjali – E16525 Assistant Professor

Identifiers: Identifiers are the names that identify the elements such as variables and functions in a program. All identifiers must obey the following rules: An identifier is a sequence of characters that consists of letters, digits, and underscores (_). 7 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

An identifier must start with a letter or an underscore. It cannot start with a digit. An identifier cannot be a keyword. An identifier can be of any length. Python is case sensitive, area, Area, and AREA are all different identifiers. 8 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

Named Constants: A named constant is an identifier that represents a permanent value. The value of a variable may change during the execution of a program, but a named constant (or simply constant) represents permanent data that never changes. 9 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

Python does not have a special syntax for naming constants. If you have to change the constant’s value (e.g., from 3.14 to 3.14159 for PI), you need to change it only in a single location in the source code. Descriptive names make the program easy to read. 10 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

What is a Variable? In Python, variables are used to store data that can be referenced and manipulated during program execution. A variable is essentially a name that is assigned to a value. Unlike many other programming languages, 11 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

Python variables do not require explicit declaration of type. The type of the variable is inferred based on the value assigned. Variables act as placeholders for data. They allow us to store and reuse values in our program. 12 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

Rules for Naming Variables To use variables effectively, we must follow Python’s naming rules: Variable names can only contain letters, digits and underscores (_). A variable name cannot start with a digit. Variable names are case-sensitive ( myVar and myvar are different). 13 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

Data Types in Python Python Data types are the classification or categorization of data items. It represents the kind of value that tells what operations can be performed on a particular data. Since everything is an object in Python programming, Python data types are classes and variables are instances (objects) of these classes. 14 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

15 Writing Python Program

Python Functions Python Functions is a block of statements that return the specific task. The idea is to put some commonly or repeatedly done tasks together and make a function so that instead of writing the same code again and again for different inputs, we can do the function calls to reuse code contained in it over and over again. 16 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

Some Benefits of Using Functions Increase Code Readability Increase Code Reusability Improves Maintainability Simplifies Testing 17 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

Types of Functions in Python Below are the different types of functions in Python: Built-in library function: These are Standard functions in Python that are available to use. User-defined function: We can create our own functions based on our requirements. 18 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

19 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

Built-in Functions: id(): The id() function returns a unique identifier for a given object. This identifier is unique and constant for the object during its lifetime. 20 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

type(): The type() function in Python is used to determine the type of an object. This function returns the type of the specified object. 21 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

range(): The range() function generates a sequence of numbers, which is often used for looping a specific number of times in for loops. 22 Writing Python Program Dr. Gitanjali – E16525 Assistant Professor

Applications of the Topic Calculator Programs Student Grade Evaluators Application Text-Based Games and Quizzes Data Entry Forms (CLI-based) Simple Automation Scripts 23 Dr. Gitanjali – E16525 Assistant Professor

Summary of the Lecture 6 Python is a high-level, interpreted language created by Guido van Rossum. Features: easy syntax, dynamically typed, portable. Covered: writing basic Python programs using print(), identifiers, variables, and naming rules. Discussed built-in functions: id(), type(), and range(). Introduced constants and basic data types: int, float, str, bool, etc. Dr. Gitanjali – E16525 Assistant Professor

Next Lecture 7 Dr. Gitanjali – E16525 Assistant Professor Topic(s) Operators in Python Control structures: if, if-else, if- elif -else, loops (for, while) Logical thinking through real-life examples

1. What is the correct way to display output in Python? A. echo "Hello, World!" B. output("Hello, World!") C. print("Hello, World!") D. display("Hello, World!") 26 Quiz/ FAQ’s Dr. Gitanjali – E16525 Assistant Professor

Which of the following is NOT a rule for naming identifiers in Python? A. Identifiers can contain letters, digits, and underscores. B. Identifiers can start with a digit. C. Identifiers are case-sensitive. D. Identifiers cannot be Python keywords. 27 Quiz/ FAQ’s Dr. Gitanjali – E16525 Assistant Professor

What is the purpose of using functions in Python? A. To store large amounts of data B. To print outputs repeatedly C. To reuse blocks of code and improve readability D. To assign memory addresses 28 Quiz/ FAQ’s Dr. Gitanjali – E16525 Assistant Professor

R eferences/ Articles/ Videos 29 Dr. Gitanjali – E16525 Assistant Professor Suggestive Readings Think Python How to Think Like a Computer Scientist (Allen B. Downey) Fundamentals of Python First Programs, 2nd Edition (Kenneth A. Lambert) Programming and Problem Solving with Python (Ashok Namdev Kamthane , Amit Ashok Kamthane )

Faculty-curated videos, NPTEL, Coursera, LinkedIn, or other relevant learning resources 30 Dr. Gitanjali – E16525 Assistant Professor https://www.coursera.org/specializations/python https://www.coursera.org/learn/python-crash-course https://nptel.ac.in/courses/106106182

Class-Wise Feedback 29 Dr. Gitanjali – E16525 Assistant Professor

Thank You 32