Introduction to
Python
jack ML
What is Python?
Python is a popular high-level programming
language used in various applications
Python is an easy language to learn
because of its simple syntax
Python can be used for simple tasks
such as plotting or for more complex
tasks like machine learning
Fun fact: Python was named after “Monty Python’s Flying Circus” (a British
comedy show), not the snake!
🤖 🌐 ⚙️ 📊
Python is everywhere: AI , Web , Automation , Data , Games . 🎮
How is it different from C/C++
Python is rather similar to C… except we use indentation instead of { … }
We also don’t need to specify data types in python unlike C
C/C++: Manual memory management (pointers, malloc/free,
new/delete). Gives fine control but can cause errors like memory leaks.
Python: Automatic memory management with Garbage Collection. Easier
but less control.
C++ is faster Why ?
Intepreted vs Compiled Language
Compiled languages :- code is converted into machine
code before execution (using gcc, g++, etc.).
Python: Interpreted :- code runs line by line with the Python
interpreter (python3 [Link]).
This makes C/C++ faster, but Python easier to test and
debug.
Compiled Language - C
Simple code to
print Hello World
Compilation step
(source→ machine code)
Running the compiled
binary
Interpreted Language - Python
Simple code to
print Hello World
Interpreter reads & executes
line by line
What does line by line execution mean ?
This Function
does not exist
Now try compiling it
The compiler
immediately throws an
error about oops_typo
and refuses to create
the program.
What does line by line execution mean ?
This Function
does not exist
Now try running it
The first two lines still executed
successfully.
The interpreter only complained
when it reached the bad line.
That’s "line-by-line execution."
.py vs .ipynb
Python Script (.py)
Plain text file containing Python code.
Runs top to bottom like a normal program.
Best for:
[Link]
[Link]/libraries
[Link] scripts
.py vs .ipynb
Python Notebook (.ipynb)
Stands for Interactive Python Notebook.
Created by Jupyter Notebook.
File format = JSON (not just text).
Code is written in cells, and you can run them independently.
Supports: Best for:
[Link] + output together [Link] Science
[Link] (text explanations) [Link] Learning
[Link]/plots inline [Link] & experiments
.py vs .ipynb
Basic Syntax Rules
Indentation defines blocks - No { } braces - indentation
(spaces/tabs) decides scope.
if True:
print("Inside block")
Comments use #
# This is a comment
Naming Conventions
CamelCase → myInt, studentName
snake_case → my_int, student_name
Basic Syntax Rules
Variable name on left of ‘=’ , Value on right of ‘=’
‘=‘ links variable name to a memory location holding the value
myInt = 10 # int
myString = "Hello, World" # string
No Type Declaration Needed - Python infers type from value
x = 42 # int
y = "text" # str
Data types
In python you don’t explicitly have to mention your data types
However, this doesn’t mean data types are irrelevant
Basic Types
int→ whole numbers →10
float→ decimal numbers → 3.14
str→ text/characters →"Hello"
bool→ True/False → True
Data types
Collection Types
list→ ordered, changeable → [1, 2, 3]
tuple → ordered, unchangeable → (1, 2, 3)
dict→ key-value pairs →
{"name": "Aakash"}
set → unique values →
{1, 2, 3}
Thank You
Thynk Unlimited Home About Content Others
Programming Concepts and Logic
At the core of programming are concepts like variables, loops, functions, and
conditional statements. These elements form the logic that drives a program, allowing
it to make decisions, process data, and perform tasks. Mastering these basics is
essential for programmers to create reliable and efficient code.
Thynk Unlimited Home About Content Others
Problem-
Solving
with Code
Programming is fundamentally
about problem-solving. A
programmer analyzes a problem,
designs a solution, and writes code
to implement it.
Thynk Unlimited Home About Content Others
Programming
Collaboration in often requires
collaboration,
Programming especially
large projects.
in
Developers use
version control
tools like Git to
manage code,
allowing
multiple
Working programmers
to work on the
Together in Code same project
seamlessly.
Thynk Unlimited Home About Content Others
Testing and debugging are
crucial steps in programming.
Testing and
Testing verifies that code
functions as expected, while
debugging identifies and
Debugging
resolves errors. By carefully
testing and refining code,
programmers ensure their
applications are reliable, user-
friendly, and free of bugs,
enhancing the end-user Working
experience.
Together in Code
Thynk Unlimited Home About Content Others
AI, Automation,
Thynk Unlimited
The future of programming
is evolving with
advancements in artificial
and Beyond intelligence, machine
learning, and automation. As
programming languages
and tools become more
sophisticated, programmers
can tackle complex tasks
more efficiently. These
The Future of developments open up new
opportunities for innovation,
Programming shaping the way we interact
with technology.