0% found this document useful (0 votes)
127 views

Basicsofpythonprogramming 201006030213

The document provides an overview of the basics of Python programming including: - Python interpreter modes of interactive and script mode. - Program structure including indentation, identifiers, keywords, variables, data types, statements, expressions, and comments. - Common data types like lists, dictionaries, strings and tuples. - Control structures like if/else statements and for loops. - How to install Python and get started with the IDLE development environment.

Uploaded by

Priya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views

Basicsofpythonprogramming 201006030213

The document provides an overview of the basics of Python programming including: - Python interpreter modes of interactive and script mode. - Program structure including indentation, identifiers, keywords, variables, data types, statements, expressions, and comments. - Common data types like lists, dictionaries, strings and tuples. - Control structures like if/else statements and for loops. - How to install Python and get started with the IDLE development environment.

Uploaded by

Priya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Basics of Python

Programming
-By Aditi Bhushan

Aditi Bhushan 1
UNIT – 2: PYTHON [REVISED SYLLABUS]
• TOTAL = 25/100 • data type conversion,
• Basics of Python programming, • debugging.
• Python interpreter - interactive and script
mode, • Control Statements: if-else, for loop
• the structure of a program, • Lists: list operations - creating,
• indentation,
initializing, traversing and
manipulating lists, list methods and
• identifiers, keywords, constants, variables, built-in functions.
• types of operators, precedence of operators, • Dictionary: concept of key-value pair,
• data types, mutable and immutable data creating, initializing, traversing,
types, updating and deleting elements,
• statements, expressions, evaluation and dictionary methods and built-in
comments, input and output statements 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

Python Interpreter
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.
Here, the symbol >>> is called Python prompt, which indicates that the
interpreter is ready to receive instructions.
Aditi Bhushan 11
Execution Modes
INTERACTIVE MODE SCRIPT MODE
• Single line code for instant • Python Program/Scripts are written
execution. and saved with .py extension.
• Good for beginners at starting. • Good for bigger programs or
• We cannot save the statements for professionals.
further use. • 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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy