Python Bootcamp
Introduction to Python
Programming
Welcome to this hands-on journey into the world of Python programming.
Whether you're taking your first steps into coding or expanding your skillset, this
bootcamp will equip you with the foundational knowledge to create, innovate, and
solve real-world problems using one of the most popular programming languages
today.
What is Python?
Python is a high-level, general-purpose programming language that has become the go-to choice for beginners and
professionals alike. Its elegant simplicity makes it perfect for newcomers, while its powerful capabilities make it indispensable
for experts.
Beginner Friendly
Clear, readable syntax that reads almost like English, making it the perfect first language for aspiring programmers.
AI & Machine Learning
The backbone of artificial intelligence development, powering everything from chatbots to self-driving cars.
Web Development
Build dynamic websites and web applications using frameworks like Django and Flask.
Data Science
Analyse, visualize, and extract insights from data using powerful libraries like Pandas and NumPy.
Your First Python Program
The Classic "Hello, World!"
Every programmer's journey begins with a simple tradition - writing a program that Code Example
prints "Hello, World!" to the screen. This timeless rite of passage introduces you to
the basic structure of Python code and gives you that first satisfying moment of
print("Hello, World!")
seeing your program run successfully.
In Python, the print() function is your gateway to outputting information. It takes This single line of code will output:
whatever you put inside the parentheses and displays it on the screen. Think of it as
your program's way of communicating with you. Hello, World!
01 02 03
print() Function Quotes Execution
Outputs text to the console screen Enclose text in quotation marks Run the program and see results
Variables & Data Types
Variables are like containers that store data in your program. Think of them as labeled boxes where you can keep information that you'll need later. Python is dynamically
typed, meaning you don't need to explicitly declare what type of data a variable will hold - Python figures it out automatically!
int (Integer) float (Float)
Whole numbers without decimal points Numbers with decimal points for precision
age = 20 height = 5.9
marks = 85 marks = 85.5
string (String) bool (Boolean)
Text enclosed in quotes (single or double) True or False values for logic
name = "Om" is_student = True
greeting = 'Hello' is_adult = False
Variable names should be descriptive and follow Python's naming conventions. Use lowercase letters, numbers, and underscores, but avoid starting with a number.
Getting Input from Users
So far, we've only sent information out using print(). But what if we want to receive information from the user? That's where the input() function
comes in! This function pauses your program and waits for the user to type something and press Enter. Whatever they type is returned as a
string, which you can store in a variable.
Basic Input Input with Conversion
name = input("Enter your name: ") age = int(input("Enter age: "))
print(name) marks = float(input("Enter marks: "))
This code asks the user for their name and then prints it back. Convert input to specific data types for calculations.
1 2 3
Prompt Display User Types Data Stored
Message shown to user Input entered and submitted Saved in variable
Conditional Statements
Decision Making in Code
Programs become truly powerful when they can make decisions based on conditions. Conditional statements allow your code to execute different blocks of code depending on whether certain
conditions are true or false. This is the foundation of logic in programming!
if Statement else Statement
Executes code if a condition is true Executes when if condition is false
age = 18 if marks >= 50:
if age >= 18: print("Pass")
print("Adult") else:
else: print("Fail")
print("Minor")
Check Condition Execute else
Evaluate if true or false Run alternative code
1 2 3
Execute if True
Run code block
You can also use elif (else if) to check multiple conditions in sequence, creating complex decision trees for sophisticated program logic.
Loops
Automating Repetition
Writing the same code multiple times is tedious and error-prone. Loops solve this problem by letting you repeat a block of code automatically. They're essential
for processing collections of data, performing calculations multiple times, or creating patterns in your programs.
for Loop
Iterate over a sequence or range
for i in range(5):
print(i)
# Output: 0, 1, 2, 3, 4
while Loop
Repeat while condition is true
count = 0
while count < 3:
print(count)
count += 1
# Output: 0, 1, 2
01
Initialization
Set starting value
02
Condition Check
Verify if loop should continue
03
Execute Code
Run the loop body
04
Update
Modify counter variable
Functions
Reusable Code Blocks
Functions are reusable blocks of code that perform specific tasks. They help you write cleaner, more organized programs by breaking complex problems into
smaller, manageable pieces. Once you define a function, you can use it anywhere in your program, saving time and reducing errors.
Defining a Function Calling a Function
Use the def keyword followed by the function name and parentheses. Parameters Use the function name followed by parentheses with arguments
(inputs) go inside the parentheses, and the code block is indented below. (values) to execute the code.
def add(a, b): add(2, 3)
result = a + b # Output: 5
print(result) add(10, 5)
# Output: 15
Reusability Organization Maintainability
Write once, use anywhere in your program Break complex code into logical pieces Fix issues in one place, update everywhere
Project: Simple Calculator
Let's put everything we've learned together into a working project! This simple calculator will take two numbers from the user, perform addition, and display the result. It combines input,
variables, arithmetic operations, and output - the core building blocks of programming.
Store Variables
Get Input Save numbers in variables
Ask user for two numbers
Display Result
Calculate Show the answer to user
Add numbers together
Complete Code
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
result = a + b
print(f"The sum is: {result}")
How it works: The program takes two inputs, converts them to integers, adds them together, and prints the result. You can expand this to include other operations like subtraction,
multiplication, and division!
Thank You!
Why Python is Your Gateway to Success
Easy to Learn Powerful Capabilities
Clear, readable syntax that reads like English. Perfect for beginners starting their Handles everything from simple scripts to complex AI systems and large-scale
programming journey. applications.
AI & Machine Learning Career Opportunities
The dominant language in artificial intelligence, powering the technology shaping High demand across industries with excellent salaries and flexible work
our future. opportunities.
You've taken the first step in your Python journey! From here, you can explore web development, data science, automation, game development, and countless other exciting paths.
Keep practising, stay curious, and don't hesitate to ask questions.
Ready for More?
Continue your learning journey by exploring Python libraries like NumPy for numerical computing, Pandas for data analysis, Matplotlib for visualization, and Flask or
Django for web development. The possibilities are endless!