SlideShare a Scribd company logo
Basics of Python
Programming
-By Aditi Bhushan
Aditi Bhushan 1
UNIT – 2: PYTHON [REVISED SYLLABUS]
• TOTAL = 25/100
• Basics of Python programming,
• Python interpreter - interactive and script
mode,
• the structure of a program,
• indentation,
• identifiers, keywords, constants, variables,
• types of operators, precedence of operators,
• data types, mutable and immutable data
types,
• statements, expressions, evaluation and
comments, input and output statements
• data type conversion,
• debugging.
• Control Statements: if-else, for loop
• Lists: list operations - creating,
initializing, traversing and
manipulating lists, list methods and
built-in functions.
• Dictionary: concept of key-value pair,
creating, initializing, traversing,
updating and deleting elements,
dictionary methods and built-in
functions.
Aditi Bhushan 2
Introduction to Python
Version Python 3 or Python 3.7.0 or Latest Version: Python 3.8.5
Aditi Bhushan 3
Why Python? (for understanding purpose, not
for evaluation)
• Powerful Language
• Supports “Scripting Language”
• Concise Formatting Style of Language
• Every Value is an Object.
• Supports iteration and abstractions – thereby making
generics easy with dynamic typing
Aditi Bhushan 4
Language Features (for understanding
purpose, not for evaluation)
• Supports Indentation instead of braces
• Powerful subscripting (slicing)
• Functions are independent entities (not all functions are methods)
• Exceptions as in Java
• Simple object system
• Iterators (like Java) and generators
• Several sequence types
• Strings ’…’: made of characters, immutable
• Lists […]: made of anything, mutable
• Tuples (…) : made of anything, immutable
Aditi Bhushan 5
Basics of Python
• Created by Guido van Rossum in 1991
• Object Oriented Programming
• Uses: software development, web development, scientific computing,
big data and artificial intelligence
• Download Latest Version of Python IDE from:
https://www.python.org/
• Online Editor for Python:
https://www.onlinegdb.com/online_python_compiler
Aditi Bhushan 6
Installation
• Python is pre-installed on most Unix systems,
including Linux and MAC OS X
• Python comes with a large library of standard modules
• There are several options for an IDE
• IDLE – works well with Windows
• Emacs with python-mode or your favorite text editor
• Eclipse with PyDev (http://pydev.sourceforge.net/ )
• PyCharm (https://www.jetbrains.com/pycharm/)
Aditi Bhushan 7
Starting with Python
Installation Steps (Please Find attached the Pics)
1. Put a tick mark on Add Path
Aditi Bhushan 8
2. Change Custom Path (Optional)
Aditi Bhushan 9
IDLE Development Environment
• IDLE is an Integrated DeveLopment Environment for Python, typically
used on Windows
• Multi-window text editor with
• syntax highlighting,
• auto-completion,
• smart indention
• Integrated debugger with
• stepping,
• persistent breakpoints,
• call stack visibility
Aditi Bhushan 10
Windows IDLE
Aditi Bhushan 11
To write and run (execute) a Python program, we need to have a
✓ Python interpreter installed on our computer or
✓ any online Python interpreter. The interpreter is also called Python shell.
Python Interpreter
Here, the symbol >>> is called Python prompt, which indicates that the
interpreter is ready to receive instructions.
Execution Modes
INTERACTIVE MODE
• Single line code for instant
execution.
• Good for beginners at starting.
• We cannot save the statements for
further use.
SCRIPT MODE
• Python Program/Scripts are written
and saved with .py extension.
• Good for bigger programs or
professionals.
• We can Save and Reuse them.
Consist of built-in editors known as
IDLE.
• By default, the Python scripts are
saved in the Python installation
folder.
Aditi Bhushan 12
COMMENTS
• Start comments with #, rest of line is ignored
• Can include “string” as the first line of a new function.
• Development environments, debugger, and other tools use it: it’s
good style to include one
def fact(n):
“““fact(n) assumes n is a positive integer and
returns factorial of n.”””
assert(n>0)
return 1 if n==1 else n*fact(n-1)
Aditi Bhushan 13

More Related Content

Similar to Basics of python programming

Introduction_to_Python.pptx
Introduction_to_Python.pptxIntroduction_to_Python.pptx
Introduction_to_Python.pptx
RahulChaudhary51756
 
Advance Python programming languages-Simple Easy learning
Advance Python programming languages-Simple Easy learningAdvance Python programming languages-Simple Easy learning
Advance Python programming languages-Simple Easy learning
sherinjoyson
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Muralidharan Deenathayalan
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Muralidharan Deenathayalan
 
Introduction to python history and platforms
Introduction to python history and platformsIntroduction to python history and platforms
Introduction to python history and platforms
Kirti Verma
 
Python Programming
Python ProgrammingPython Programming
Python Programming
RenieMathews
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programmingChetan Giridhar
 
Python programming
Python programmingPython programming
Python programming
saroja20
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Mohammed Rafi
 
Python Course In Chandigarh
Python Course In ChandigarhPython Course In Chandigarh
Python Course In Chandigarh
Excellence Academy
 
Python Open Session.pptx
Python Open Session.pptxPython Open Session.pptx
Python Open Session.pptx
19526YuvaKumarIrigi
 
Exploring Five Lesser-Known Python Libraries
Exploring Five Lesser-Known Python LibrariesExploring Five Lesser-Known Python Libraries
Exploring Five Lesser-Known Python Libraries
MinhazulAbedin27
 
report on internshala python training
 report on internshala python  training  report on internshala python  training
report on internshala python training
surabhimalviya1
 
IPT 2.pptx
IPT 2.pptxIPT 2.pptx
IPT 2.pptx
CHRISPay4
 
Top 10 python ide
Top 10 python ideTop 10 python ide
Top 10 python ide
Saravanakumar viswanathan
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
Bhavsingh Maloth
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
Gnanesh12
 
ppt notes for python language variable data types
ppt notes for python language variable data typesppt notes for python language variable data types
ppt notes for python language variable data types
SukhpreetSingh519414
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
KPDDRAVIDIAN
 

Similar to Basics of python programming (20)

Introduction_to_Python.pptx
Introduction_to_Python.pptxIntroduction_to_Python.pptx
Introduction_to_Python.pptx
 
Advance Python programming languages-Simple Easy learning
Advance Python programming languages-Simple Easy learningAdvance Python programming languages-Simple Easy learning
Advance Python programming languages-Simple Easy learning
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
 
Introduction to python history and platforms
Introduction to python history and platformsIntroduction to python history and platforms
Introduction to python history and platforms
 
Python Programming
Python ProgrammingPython Programming
Python Programming
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programming
 
Python programming
Python programmingPython programming
Python programming
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python Course In Chandigarh
Python Course In ChandigarhPython Course In Chandigarh
Python Course In Chandigarh
 
Python Open Session.pptx
Python Open Session.pptxPython Open Session.pptx
Python Open Session.pptx
 
Exploring Five Lesser-Known Python Libraries
Exploring Five Lesser-Known Python LibrariesExploring Five Lesser-Known Python Libraries
Exploring Five Lesser-Known Python Libraries
 
report on internshala python training
 report on internshala python  training  report on internshala python  training
report on internshala python training
 
IPT 2.pptx
IPT 2.pptxIPT 2.pptx
IPT 2.pptx
 
Top 10 python ide
Top 10 python ideTop 10 python ide
Top 10 python ide
 
What is Python?
What is Python?What is Python?
What is Python?
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
 
ppt notes for python language variable data types
ppt notes for python language variable data typesppt notes for python language variable data types
ppt notes for python language variable data types
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 

More from Aditi Bhushan

Binary Search
Binary SearchBinary Search
Binary Search
Aditi Bhushan
 
Chapter 15 [Bhagvad Geeta]
Chapter 15 [Bhagvad Geeta]Chapter 15 [Bhagvad Geeta]
Chapter 15 [Bhagvad Geeta]
Aditi Bhushan
 
COMPUTER SCIENCE CLASS 11
COMPUTER SCIENCE CLASS 11COMPUTER SCIENCE CLASS 11
COMPUTER SCIENCE CLASS 11
Aditi Bhushan
 
HTML and CSS codes
HTML and CSS codesHTML and CSS codes
HTML and CSS codes
Aditi Bhushan
 
HTML codes 1
HTML codes 1HTML codes 1
HTML codes 1
Aditi Bhushan
 
Basics of Information Technology
Basics of Information TechnologyBasics of Information Technology
Basics of Information Technology
Aditi Bhushan
 
Calculation of Area of Circle and Rectangle
Calculation of Area of Circle and RectangleCalculation of Area of Circle and Rectangle
Calculation of Area of Circle and Rectangle
Aditi Bhushan
 
Calculation of first 100 numbers using do-until loop
Calculation of first 100 numbers using do-until loopCalculation of first 100 numbers using do-until loop
Calculation of first 100 numbers using do-until loop
Aditi Bhushan
 
HSc Information Technology Practical List
HSc Information Technology Practical List HSc Information Technology Practical List
HSc Information Technology Practical List
Aditi Bhushan
 
HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12
Aditi Bhushan
 
Cpp source code1
Cpp source code1Cpp source code1
Cpp source code1
Aditi Bhushan
 
Fibonacci Series Program in C++
Fibonacci Series Program in C++Fibonacci Series Program in C++
Fibonacci Series Program in C++
Aditi Bhushan
 
Visual Basic Source Codes for Class 11 HSc Paper 1 Practicals
Visual Basic Source Codes for Class 11 HSc Paper 1 PracticalsVisual Basic Source Codes for Class 11 HSc Paper 1 Practicals
Visual Basic Source Codes for Class 11 HSc Paper 1 Practicals
Aditi Bhushan
 
Introduction to Visual basic 6.0
Introduction to Visual basic 6.0Introduction to Visual basic 6.0
Introduction to Visual basic 6.0
Aditi Bhushan
 
Functional hardware of pc
Functional hardware of pcFunctional hardware of pc
Functional hardware of pc
Aditi Bhushan
 
Language and its Function
Language and its FunctionLanguage and its Function
Language and its Function
Aditi Bhushan
 
Teacher autonomy : a tool to create learner autonomy
Teacher autonomy : a tool to create learner autonomyTeacher autonomy : a tool to create learner autonomy
Teacher autonomy : a tool to create learner autonomy
Aditi Bhushan
 
Importance of body language at workplace
Importance of body language at workplaceImportance of body language at workplace
Importance of body language at workplace
Aditi Bhushan
 
Role of indian govt. portal e pg pathshala
Role of indian govt. portal e pg pathshalaRole of indian govt. portal e pg pathshala
Role of indian govt. portal e pg pathshala
Aditi Bhushan
 
conservation of solar energy
conservation of solar energyconservation of solar energy
conservation of solar energy
Aditi Bhushan
 

More from Aditi Bhushan (20)

Binary Search
Binary SearchBinary Search
Binary Search
 
Chapter 15 [Bhagvad Geeta]
Chapter 15 [Bhagvad Geeta]Chapter 15 [Bhagvad Geeta]
Chapter 15 [Bhagvad Geeta]
 
COMPUTER SCIENCE CLASS 11
COMPUTER SCIENCE CLASS 11COMPUTER SCIENCE CLASS 11
COMPUTER SCIENCE CLASS 11
 
HTML and CSS codes
HTML and CSS codesHTML and CSS codes
HTML and CSS codes
 
HTML codes 1
HTML codes 1HTML codes 1
HTML codes 1
 
Basics of Information Technology
Basics of Information TechnologyBasics of Information Technology
Basics of Information Technology
 
Calculation of Area of Circle and Rectangle
Calculation of Area of Circle and RectangleCalculation of Area of Circle and Rectangle
Calculation of Area of Circle and Rectangle
 
Calculation of first 100 numbers using do-until loop
Calculation of first 100 numbers using do-until loopCalculation of first 100 numbers using do-until loop
Calculation of first 100 numbers using do-until loop
 
HSc Information Technology Practical List
HSc Information Technology Practical List HSc Information Technology Practical List
HSc Information Technology Practical List
 
HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12
 
Cpp source code1
Cpp source code1Cpp source code1
Cpp source code1
 
Fibonacci Series Program in C++
Fibonacci Series Program in C++Fibonacci Series Program in C++
Fibonacci Series Program in C++
 
Visual Basic Source Codes for Class 11 HSc Paper 1 Practicals
Visual Basic Source Codes for Class 11 HSc Paper 1 PracticalsVisual Basic Source Codes for Class 11 HSc Paper 1 Practicals
Visual Basic Source Codes for Class 11 HSc Paper 1 Practicals
 
Introduction to Visual basic 6.0
Introduction to Visual basic 6.0Introduction to Visual basic 6.0
Introduction to Visual basic 6.0
 
Functional hardware of pc
Functional hardware of pcFunctional hardware of pc
Functional hardware of pc
 
Language and its Function
Language and its FunctionLanguage and its Function
Language and its Function
 
Teacher autonomy : a tool to create learner autonomy
Teacher autonomy : a tool to create learner autonomyTeacher autonomy : a tool to create learner autonomy
Teacher autonomy : a tool to create learner autonomy
 
Importance of body language at workplace
Importance of body language at workplaceImportance of body language at workplace
Importance of body language at workplace
 
Role of indian govt. portal e pg pathshala
Role of indian govt. portal e pg pathshalaRole of indian govt. portal e pg pathshala
Role of indian govt. portal e pg pathshala
 
conservation of solar energy
conservation of solar energyconservation of solar energy
conservation of solar energy
 

Recently uploaded

Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 

Recently uploaded (20)

Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 

Basics of python programming

  • 1. Basics of Python Programming -By Aditi Bhushan Aditi Bhushan 1
  • 2. UNIT – 2: PYTHON [REVISED SYLLABUS] • TOTAL = 25/100 • Basics of Python programming, • Python interpreter - interactive and script mode, • the structure of a program, • indentation, • identifiers, keywords, constants, variables, • types of operators, precedence of operators, • data types, mutable and immutable data types, • statements, expressions, evaluation and comments, input and output statements • data type conversion, • debugging. • Control Statements: if-else, for loop • Lists: list operations - creating, initializing, traversing and manipulating lists, list methods and built-in functions. • Dictionary: concept of key-value pair, creating, initializing, traversing, updating and deleting elements, dictionary methods and built-in functions. Aditi Bhushan 2
  • 3. Introduction to Python Version Python 3 or Python 3.7.0 or Latest Version: Python 3.8.5 Aditi Bhushan 3
  • 4. Why Python? (for understanding purpose, not for evaluation) • Powerful Language • Supports “Scripting Language” • Concise Formatting Style of Language • Every Value is an Object. • Supports iteration and abstractions – thereby making generics easy with dynamic typing Aditi Bhushan 4
  • 5. Language Features (for understanding purpose, not for evaluation) • Supports Indentation instead of braces • Powerful subscripting (slicing) • Functions are independent entities (not all functions are methods) • Exceptions as in Java • Simple object system • Iterators (like Java) and generators • Several sequence types • Strings ’…’: made of characters, immutable • Lists […]: made of anything, mutable • Tuples (…) : made of anything, immutable Aditi Bhushan 5
  • 6. Basics of Python • Created by Guido van Rossum in 1991 • Object Oriented Programming • Uses: software development, web development, scientific computing, big data and artificial intelligence • Download Latest Version of Python IDE from: https://www.python.org/ • Online Editor for Python: https://www.onlinegdb.com/online_python_compiler Aditi Bhushan 6
  • 7. Installation • Python is pre-installed on most Unix systems, including Linux and MAC OS X • Python comes with a large library of standard modules • There are several options for an IDE • IDLE – works well with Windows • Emacs with python-mode or your favorite text editor • Eclipse with PyDev (http://pydev.sourceforge.net/ ) • PyCharm (https://www.jetbrains.com/pycharm/) Aditi Bhushan 7
  • 8. Starting with Python Installation Steps (Please Find attached the Pics) 1. Put a tick mark on Add Path Aditi Bhushan 8
  • 9. 2. Change Custom Path (Optional) Aditi Bhushan 9
  • 10. IDLE Development Environment • IDLE is an Integrated DeveLopment Environment for Python, typically used on Windows • Multi-window text editor with • syntax highlighting, • auto-completion, • smart indention • Integrated debugger with • stepping, • persistent breakpoints, • call stack visibility Aditi Bhushan 10
  • 11. Windows IDLE Aditi Bhushan 11 To write and run (execute) a Python program, we need to have a ✓ Python interpreter installed on our computer or ✓ any online Python interpreter. The interpreter is also called Python shell. Python Interpreter Here, the symbol >>> is called Python prompt, which indicates that the interpreter is ready to receive instructions.
  • 12. Execution Modes INTERACTIVE MODE • Single line code for instant execution. • Good for beginners at starting. • We cannot save the statements for further use. SCRIPT MODE • Python Program/Scripts are written and saved with .py extension. • Good for bigger programs or professionals. • We can Save and Reuse them. Consist of built-in editors known as IDLE. • By default, the Python scripts are saved in the Python installation folder. Aditi Bhushan 12
  • 13. COMMENTS • Start comments with #, rest of line is ignored • Can include “string” as the first line of a new function. • Development environments, debugger, and other tools use it: it’s good style to include one def fact(n): “““fact(n) assumes n is a positive integer and returns factorial of n.””” assert(n>0) return 1 if n==1 else n*fact(n-1) Aditi Bhushan 13