SlideShare a Scribd company logo
Introduction
to Python
and Basic
Syntax
By
Gv
Objectives:
Understand the basics of Python
programming.
Set up the Python environment.
Write simple Python scripts.
Overview of Python
What is Python?
General Purpose Language
Python is a high-level, interpreted programming
language known for its readability and versatility. It can
be used for a wide range of applications, from web
development to scientific computing.
Easy to Learn
Python’s syntax is clear and intuitive, making it an
excellent choice for beginners while still powerful
enough for experienced programmers.
Interpreted Language
Python is an interpreted language, meaning code is
executed line by line, which can simplify debugging
and development.
Dynamic Typing
Variables in Python do not need explicit declaration to
reserve memory space. The declaration happens
automatically when you assign a value to a variable.
Extensive Standard Library
Python comes with a large standard library that
includes modules and functions for tasks such as file
I/O, system calls, and even web development.
Python Key Features
Readability
Interoperability
Community and Support
Portability
Python's Popularity
Widely used in various domains including
web development, data science, machine
learning, artificial intelligence, and
automation.
Supported by many large companies (e.g.,
Google, NASA, CERN).
Python’s Applications in
Mechatronics
Automation and Control
Robotics
Automated Testing
Data Acquisition and Analysis
Sensor Data Collection
Data Processing
Machine Learning and Artificial Intelligence
Predictive Maintenance
Computer Vision
Simulation and Modeling
System Simulation
Control System Design
Embedded Systems and IoT
Microcontroller Programming
IoT Applications
Visualization and Reporting
Data Visualization
Reporting Tools
Setting Up the Environment
1. Installing Python
Download Python
Go to the official Python website: python.org.
Click on the "Downloads" section.
Choose the version of Python you need (the latest
version is recommended) and download the installer for
your operating system (Windows, macOS, Linux).
Install Python on your
computer.
You can download it from the [official Python
website]
(https://www.python.org/downloads/).
Select Install Now
Installation on Progress
Setup was Successful
Verify the Installation
Open a command prompt (Windows) or terminal
(macOS/Linux).
Type python --version or python3 --version
and press Enter
Setting Up VSCode
Download VSCode
Visit the Visual Studio Code website.
Download the installer for your operating system.
Install VSCode
Run the installer and follow the setup wizard.
Customize the installation settings if necessary.
Setting Up VSCode
Configure VSCode for Python
Open VSCode after installation.
Install the Python extension for VSCode by
Microsoft:
Set the Python interpreter by opening the
Command Palette (Ctrl+Shift+P), typing "Python:
Select Interpreter," and selecting the installed
Python version.
Introduction to Python and Basic Syntax.pptx
Running Python Scripts
Write a Script:
Open your IDE and create a new file with a
.py extension, e.g., hello.py.
Write a simple Python script
Running Python Scripts
Save the Script:
Save the file in your desired directory.
Run the Script:
Open the command prompt or terminal.
Navigate to the directory where your script is
saved using the cd command.
Run the script by typing python hello.py or
python3 hello.py and pressing Enter. You should
see the output Hello, World!
Variables and Data Types
Integer (int):
Represents whole numbers, positive or negative,
without decimals.
Example: a = 10, b = -3.
Float (float):
Represents real numbers, positive or negative,
with decimals.
Example: pi = 3.14, gravity = 9.8.
Variables and Data Types
String (str):
Represents sequences of characters.
Strings are enclosed in single, double, or triple
quotes.
Example: name = "Alice", message = 'Hello, World!'.
Boolean (bool):
Represents one of two values: True or False.
Useful for conditions and comparisons.
Example: is_valid = True, has_error = False.
Basic Operations
Arithmetic Operations:
Addition (+): result = 5 + 3 (result is 8).
Subtraction (-): result = 5 - 3 (result is 2).
Multiplication (*): result = 5 * 3 (result is 15).
Division (/): result = 5 / 3 (result is approximately 1.6667).
Floor Division (//): result = 5 // 3 (result is 1, discarding the remainder).
Modulus (%): result = 5 % 3 (result is 2, the remainder of the division).
Exponentiation ()**: result = 5 ** 3 (result is 125).
Basic Operations
Logical Operations:
And (and): Returns True if both operands are true.
result = (5 > 3) and (3 < 4) (result is True).
Or (or): Returns True if at least one operand is true.
result = (5 > 3) or (3 > 4) (result is True).
Not (not): Returns True if the operand is false.
result = not (5 > 3) (result is False).
Input and Output Functions
Input Function: Used to take input from the
user.
input(prompt): Reads a line from input,
converts it to a string, and returns it.
Input and Output Functions
Output Function: Used to display output to
the user.
print(): Prints the given object(s) to the
console.
Control Structures in
Python
The primary control structures in Python are:
If Statements
Loops (for, while)
If Statements
If statements allow you to execute a block of
code only if a specified condition is true.
They are used for decision-making in your
code.
Syntax:
Example
Loops
Loops allow you to execute a block of code
multiple times. Python has two main types of
loops: for and while.
For Loops
For loops are used to iterate over a sequence (like a list,
tuple, dictionary, set, or string) and execute a block of code
for each element in the sequence.
Syntax:
Example:
While Loops
While loops execute a block of code as long
as a specified condition is true.
Syntax:
Example:
Combining If Statements
and Loops
Assignment
Write a script to convert temperature units
(Celsius to Fahrenheit).
Write a script to check if a number is prime.
THANK YOU

More Related Content

PPTX
Data types in python
PPTX
Variables in C and C++ Language
PPTX
Array Introduction One-dimensional array Multidimensional array
PPTX
Loops in Python
PPTX
Python Exception Handling
PDF
Pointers in C
PPT
1.python interpreter and interactive mode
PPTX
Constructor and Types of Constructors
Data types in python
Variables in C and C++ Language
Array Introduction One-dimensional array Multidimensional array
Loops in Python
Python Exception Handling
Pointers in C
1.python interpreter and interactive mode
Constructor and Types of Constructors

What's hot (20)

PPTX
Python for kids - 1.pptx
PPTX
Union in c language
PPTX
C Token’s
PDF
Java thread life cycle
PPTX
Python strings presentation
PPTX
Pointers in C
PPT
Operators in C++
PDF
Object oriented programming c++
PPTX
Python Tutorial Part 1
PPT
Strings
PPTX
Looping Statements and Control Statements in Python
PPTX
File handling in c++
PPTX
PPTX
Storage class in C Language
PPT
Python Control structures
PDF
Variables & Data Types In Python | Edureka
PPTX
Python Functions
PPT
Control Structures
PPTX
Strings in C
PPSX
Type conversion
Python for kids - 1.pptx
Union in c language
C Token’s
Java thread life cycle
Python strings presentation
Pointers in C
Operators in C++
Object oriented programming c++
Python Tutorial Part 1
Strings
Looping Statements and Control Statements in Python
File handling in c++
Storage class in C Language
Python Control structures
Variables & Data Types In Python | Edureka
Python Functions
Control Structures
Strings in C
Type conversion
Ad

Similar to Introduction to Python and Basic Syntax.pptx (20)

DOCX
A Introduction Book of python For Beginners.docx
PPTX
Introduction-to-Python-Programming1.pptx
PPTX
lecture 2.pptx
PPTX
Chapter1 python introduction syntax general
PDF
05 python.pdf
PPTX
python_module_.................................................................
PPTX
Module-1.pptx
PDF
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
PPT
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
PPTX
Python Basics
PPTX
Lecture1_introduction to python.pptx
PDF
Python Programing Bio computing,basic concepts lab,,
PDF
Python basic programing language for automation
PDF
python.pdf
PPTX
python presntation 2.pptx
PPT
Py-Slides-1.ppt1234444444444444444444444444444444444444444
PPT
Python Over View (Python for mobile app Devt)1.ppt
PPT
program on python what is python where it was started by whom started
PPT
Python slides for the beginners to learn
PPTX
Introduction To Python.pptx
A Introduction Book of python For Beginners.docx
Introduction-to-Python-Programming1.pptx
lecture 2.pptx
Chapter1 python introduction syntax general
05 python.pdf
python_module_.................................................................
Module-1.pptx
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
Python Basics
Lecture1_introduction to python.pptx
Python Programing Bio computing,basic concepts lab,,
Python basic programing language for automation
python.pdf
python presntation 2.pptx
Py-Slides-1.ppt1234444444444444444444444444444444444444444
Python Over View (Python for mobile app Devt)1.ppt
program on python what is python where it was started by whom started
Python slides for the beginners to learn
Introduction To Python.pptx
Ad

More from GevitaChinnaiah (20)

PPTX
Mobile Application and Developments.pptx
PPTX
White Box Testing on a Python Function.pptx
PPTX
Building a To-Do List App lecture 1.pptx
PPTX
Software Quality and Testing note 1.pptx
PPTX
Introduction to JavaScript DOM and User Input.pptx
PPT
391Lecture0909 Vision control of git.ppt
PPTX
Software Programming with Python II.pptx
PPT
a basic java programming and data type.ppt
PPTX
Install an Operating System.pptx
PPTX
Solve Stop Code Memory Management on Windows.pptx
PPTX
windows memory management.pptx
PPTX
Introduction to Database Management.pptx
PPT
OPERATING SYSTEM CHAPTER 3.ppt
PPTX
Lecture 3 React Native with Database.pptx
PPTX
Database Management System (DBMS).pptx
PPTX
Operating System chapter 1.pptx
PPTX
Lecture 2 Styling and Layout in React Native.pptx
PPTX
Lecture 1 Introduction to React Native.pptx
PPTX
Understanding Applications.pptx
PPTX
Operating System 2.pptx
Mobile Application and Developments.pptx
White Box Testing on a Python Function.pptx
Building a To-Do List App lecture 1.pptx
Software Quality and Testing note 1.pptx
Introduction to JavaScript DOM and User Input.pptx
391Lecture0909 Vision control of git.ppt
Software Programming with Python II.pptx
a basic java programming and data type.ppt
Install an Operating System.pptx
Solve Stop Code Memory Management on Windows.pptx
windows memory management.pptx
Introduction to Database Management.pptx
OPERATING SYSTEM CHAPTER 3.ppt
Lecture 3 React Native with Database.pptx
Database Management System (DBMS).pptx
Operating System chapter 1.pptx
Lecture 2 Styling and Layout in React Native.pptx
Lecture 1 Introduction to React Native.pptx
Understanding Applications.pptx
Operating System 2.pptx

Recently uploaded (20)

PPTX
AIRLINE PRICE API | FLIGHT API COST |
PDF
System and Network Administraation Chapter 3
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Become an Agentblazer Champion Challenge Kickoff
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Digital Strategies for Manufacturing Companies
PDF
medical staffing services at VALiNTRY
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
How Creative Agencies Leverage Project Management Software.pdf
DOCX
The Five Best AI Cover Tools in 2025.docx
PDF
AI in Product Development-omnex systems
PDF
Build Multi-agent using Agent Development Kit
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
PPTX
Introduction to Artificial Intelligence
PDF
How to Confidently Manage Project Budgets
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
AIRLINE PRICE API | FLIGHT API COST |
System and Network Administraation Chapter 3
The Role of Automation and AI in EHS Management for Data Centers.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Become an Agentblazer Champion Challenge Kickoff
VVF-Customer-Presentation2025-Ver1.9.pptx
Digital Strategies for Manufacturing Companies
medical staffing services at VALiNTRY
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
How Creative Agencies Leverage Project Management Software.pdf
The Five Best AI Cover Tools in 2025.docx
AI in Product Development-omnex systems
Build Multi-agent using Agent Development Kit
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
Introduction to Artificial Intelligence
How to Confidently Manage Project Budgets
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
How to Choose the Right IT Partner for Your Business in Malaysia

Introduction to Python and Basic Syntax.pptx

  • 2. Objectives: Understand the basics of Python programming. Set up the Python environment. Write simple Python scripts.
  • 3. Overview of Python What is Python? General Purpose Language Python is a high-level, interpreted programming language known for its readability and versatility. It can be used for a wide range of applications, from web development to scientific computing.
  • 4. Easy to Learn Python’s syntax is clear and intuitive, making it an excellent choice for beginners while still powerful enough for experienced programmers. Interpreted Language Python is an interpreted language, meaning code is executed line by line, which can simplify debugging and development.
  • 5. Dynamic Typing Variables in Python do not need explicit declaration to reserve memory space. The declaration happens automatically when you assign a value to a variable. Extensive Standard Library Python comes with a large standard library that includes modules and functions for tasks such as file I/O, system calls, and even web development.
  • 7. Python's Popularity Widely used in various domains including web development, data science, machine learning, artificial intelligence, and automation. Supported by many large companies (e.g., Google, NASA, CERN).
  • 8. Python’s Applications in Mechatronics Automation and Control Robotics Automated Testing Data Acquisition and Analysis Sensor Data Collection Data Processing Machine Learning and Artificial Intelligence Predictive Maintenance Computer Vision
  • 9. Simulation and Modeling System Simulation Control System Design Embedded Systems and IoT Microcontroller Programming IoT Applications Visualization and Reporting Data Visualization Reporting Tools
  • 10. Setting Up the Environment 1. Installing Python Download Python Go to the official Python website: python.org. Click on the "Downloads" section. Choose the version of Python you need (the latest version is recommended) and download the installer for your operating system (Windows, macOS, Linux).
  • 11. Install Python on your computer. You can download it from the [official Python website] (https://www.python.org/downloads/).
  • 15. Verify the Installation Open a command prompt (Windows) or terminal (macOS/Linux). Type python --version or python3 --version and press Enter
  • 16. Setting Up VSCode Download VSCode Visit the Visual Studio Code website. Download the installer for your operating system. Install VSCode Run the installer and follow the setup wizard. Customize the installation settings if necessary.
  • 17. Setting Up VSCode Configure VSCode for Python Open VSCode after installation. Install the Python extension for VSCode by Microsoft: Set the Python interpreter by opening the Command Palette (Ctrl+Shift+P), typing "Python: Select Interpreter," and selecting the installed Python version.
  • 19. Running Python Scripts Write a Script: Open your IDE and create a new file with a .py extension, e.g., hello.py. Write a simple Python script
  • 20. Running Python Scripts Save the Script: Save the file in your desired directory. Run the Script: Open the command prompt or terminal. Navigate to the directory where your script is saved using the cd command. Run the script by typing python hello.py or python3 hello.py and pressing Enter. You should see the output Hello, World!
  • 21. Variables and Data Types Integer (int): Represents whole numbers, positive or negative, without decimals. Example: a = 10, b = -3. Float (float): Represents real numbers, positive or negative, with decimals. Example: pi = 3.14, gravity = 9.8.
  • 22. Variables and Data Types String (str): Represents sequences of characters. Strings are enclosed in single, double, or triple quotes. Example: name = "Alice", message = 'Hello, World!'. Boolean (bool): Represents one of two values: True or False. Useful for conditions and comparisons. Example: is_valid = True, has_error = False.
  • 23. Basic Operations Arithmetic Operations: Addition (+): result = 5 + 3 (result is 8). Subtraction (-): result = 5 - 3 (result is 2). Multiplication (*): result = 5 * 3 (result is 15). Division (/): result = 5 / 3 (result is approximately 1.6667). Floor Division (//): result = 5 // 3 (result is 1, discarding the remainder). Modulus (%): result = 5 % 3 (result is 2, the remainder of the division). Exponentiation ()**: result = 5 ** 3 (result is 125).
  • 24. Basic Operations Logical Operations: And (and): Returns True if both operands are true. result = (5 > 3) and (3 < 4) (result is True). Or (or): Returns True if at least one operand is true. result = (5 > 3) or (3 > 4) (result is True). Not (not): Returns True if the operand is false. result = not (5 > 3) (result is False).
  • 25. Input and Output Functions Input Function: Used to take input from the user. input(prompt): Reads a line from input, converts it to a string, and returns it.
  • 26. Input and Output Functions Output Function: Used to display output to the user. print(): Prints the given object(s) to the console.
  • 27. Control Structures in Python The primary control structures in Python are: If Statements Loops (for, while)
  • 28. If Statements If statements allow you to execute a block of code only if a specified condition is true. They are used for decision-making in your code. Syntax:
  • 30. Loops Loops allow you to execute a block of code multiple times. Python has two main types of loops: for and while. For Loops For loops are used to iterate over a sequence (like a list, tuple, dictionary, set, or string) and execute a block of code for each element in the sequence.
  • 32. While Loops While loops execute a block of code as long as a specified condition is true. Syntax: Example:
  • 34. Assignment Write a script to convert temperature units (Celsius to Fahrenheit). Write a script to check if a number is prime.