0% found this document useful (0 votes)
9 views33 pages

Python Programming Presentation

Full Python Course

Uploaded by

lalitmguptaamu
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)
9 views33 pages

Python Programming Presentation

Full Python Course

Uploaded by

lalitmguptaamu
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/ 33

Python Programming

Mr. Lalit Mohan Gupta


Assistant professor
Greater Noida Institute of Technology
CSE, Department
Introduction
• Why Python?
• Simple, readable, powerful
• Widely used in Data Science, AI, Web
Development, Automation
History of Python
• Developed by Guido van Rossum (1991)
• Open-source, cross-platform
• Huge community support
Features of Python
• Easy to learn, read, and write
• Interpreted & dynamically typed
• Huge library support
• Cross-platform compatibility
Applications of Python
• Web Development (Django, Flask)
• Data Science (NumPy, Pandas, Matplotlib)
• Artificial Intelligence & Machine Learning
• Automation & Scripting
• Game Development
Installing Python
• Download from python.org
• Using IDEs: PyCharm, VS Code, Jupyter
Notebook, Google Colab
Python Basics
• First Program: print("Hello, World!")
• Comments in Python: # This is a comment
Variables and Data Types
• Numbers, Strings, Lists, Tuples, Dictionaries
• Dynamic typing example
A=10, name=“Mr. Lalit Mohan Gupta”, b=10.5
x = 10 # int
y = "Hello" # str
z = 3.14 # float
Operators
• Arithmetic, Relational, Logical, Assignment,
Membership
a = 10; b = 5
print(a > b and b < 10) # True
Input/Output
• input() function
• Formatted output using f-strings
name = “Mr. Lalit Mohan Gupta"
print(f"Hello {name}")
Conditional Statements
• if, if-else, elif
• Example: Even/Odd program
num = int(input("Enter a number: "))
if num % 2 == 0:
print("Even")
else:
print("Odd")
Loops
• for loop with range()
• while loop
• Loop control: break, continue, pass
for i in range(5):
if i == 3: continue
print(i)
Functions
• Defining functions with def
• Returning values
• Default & keyword arguments
def add(a, b):
return a + b
print(add(3, 5))
Recursion
• Factorial program using recursion
def fact(n):
if n == 1:
return 1
return n * fact(n-1)
Strings
• String operations
• Slicing, indexing, built-in methods
fruits = ["apple", "banana", "cherry"]
fruits.append("mango")
Lists
• Creating lists
• Indexing & slicing
• append, remove, sort
fruits = ["apple", "banana", "cherry"]
fruits.append("mango")
Tuples
• Immutable lists
• When to use tuples
t = (1, 2, 3)

Faster, useful when data should not change


Dictionaries
• Key-value pairs
• Adding, deleting, accessing elements
student = {"name": "Ravi", "age": 20}
print(student["name"])
Sets
• Unordered, unique items
• Union, intersection, difference
s = {1, 2, 3, 3}
print(s) # {1, 2, 3}
File Handling
• Opening and closing files
• Reading and writing files
with open("test.txt", "w") as f:
f.write("Hello File")
Exception Handling
• try, except, finally
• Example: Handling division by zero
try:
x = 10 / 0
except ZeroDivisionError:
print("Cannot divide by zero")
finally:
print("Done")
Object-Oriented Programming
• Classes and Objects
• Constructors (__init__)
• Example: Student class
class Student:
def __init__(self, name):
self.name = name
s1 = Student("Ravi")
print(s1.name)
Inheritance
• Single & multiple inheritance
• Example with base and derived class
class Animal:
def sound(self): print("Sound")
class Dog(Animal):
def sound(self): print("Bark")
Modules & Packages
• Importing modules (math, random)
• Creating your own module
import math
print(math.sqrt(16))
Python Libraries Overview
• NumPy – Numerical Computing
• Pandas – Data Analysis
• Matplotlib – Data Visualization
Python for Automation
• Rename multiple files
• Web scraping with requests, BeautifulSoup
Python in Data Science & AI
• Machine Learning: scikit-learn
• Deep Learning: TensorFlow, PyTorch
Hands-on Example
• Write a program to calculate student grade
based on marks
marks = int(input("Enter marks: "))
if marks >= 90: print("Grade A")
elif marks >= 75: print("Grade B")
else: print("Grade C")
Best Practices
• Meaningful variable names
• Comment your code
• Follow PEP-8 style guide
Career Opportunities
• Data Scientist
• AI/ML Engineer
• Web Developer
• Automation Engineer
Summary
• Python basics → Data types, control flow,
functions
• OOP concepts
• Applications & future scope
References
• Python Official Documentation
• TutorialsPoint / GeeksforGeeks
• W3Schools / Programiz
Thank You

Questions & Answers

You might also like