0% found this document useful (0 votes)
18 views1 page

Python Programming Notes: Units I & II

The document provides an introduction to Python programming, covering its basics, variables, operators, coding standards, and control structures in Unit I. Unit II focuses on string manipulation, lists, and tuples, detailing their properties and common operations. Overall, it emphasizes Python's simple syntax and dynamic typing for effective programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Python Programming Notes: Units I & II

The document provides an introduction to Python programming, covering its basics, variables, operators, coding standards, and control structures in Unit I. Unit II focuses on string manipulation, lists, and tuples, detailing their properties and common operations. Overall, it emphasizes Python's simple syntax and dynamic typing for effective programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Programming – Unit I & II Notes

UNIT I: Introduction to Python


Introduction and Basics: Python is a high-level, interpreted, object-oriented programming language
known for its simple syntax, portability, and dynamic typing.

Setting up Path: After installation, set the PATH environment variable so Python can run from any
directory. Example: C:\Python311\Scripts\

Variables & Operators: Variables store data. No type declaration needed. Data types include int, float,
str, bool, list, tuple, set, dict.
Operators: Arithmetic (+, -, *, /), Comparison (==, !=), Logical (and, or, not), Assignment (=, +=),
Membership (in, not in), Identity (is, is not).

id() and type(): id() returns memory address, type() returns data type.

Coding Standards: Follow PEP8 — meaningful names, indentation (4 spaces), comments,


lowercase_with_underscores for names.

Input-Output: print() for output, input() for input. Example: name = input("Enter name: ")

Control Structures: if-elif-else, nested if, loops (for, while). Use break (exit loop), continue (skip), pass
(placeholder).

UNIT II: String Manipulation, Lists and Tuples


String Manipulation: Strings are sequences of characters. Operations include concatenation (+),
repetition (*), and slicing (s[0:5]).
Common methods: upper(), lower(), title(), strip(), replace(), split(), find(), count().

Lists: Ordered, mutable collections. Example: fruits = ["apple", "banana"].


Access elements using index, perform operations like append(), remove(), sort(), reverse().

Tuples: Ordered, immutable sequences. Example: t = (10, 20, 30).


Operations: len(t), max(t), min(t), count(), index(). Can convert between lists and tuples.

Summary: Python provides simple syntax, dynamic typing, and versatile structures like strings, lists,
and tuples for effective programming.

You might also like