0% found this document useful (0 votes)
18 views2 pages

Python Basics for Deep Learning

This document provides an introduction to Python programming, highlighting its key features such as simplicity, portability, and a large standard library. It covers the structure of Python programs, the use of indentation, and various programming concepts including identifiers, keywords, data types, and operators. The document emphasizes the importance of clarity and logic in 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 views2 pages

Python Basics for Deep Learning

This document provides an introduction to Python programming, highlighting its key features such as simplicity, portability, and a large standard library. It covers the structure of Python programs, the use of indentation, and various programming concepts including identifiers, keywords, data types, and operators. The document emphasizes the importance of clarity and logic in 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

Unit 2: Introduction to Python – Deep Learning

Notes

1. Basics of Python Programming


Python is a high-level, interpreted programming language known for its simplicity and readability.

Key Features:
• Easy to learn and write
• Open-source and free
• Portable (runs on all platforms)
• Dynamically typed (no need for variable type declaration)
• Large standard library

2. Python Interpreter
Mode Description Example
Interactive Executes code line-by-line in REPL Type python in terminal
Script Executes code saved in a .py file python [Link]

3. Structure of a Python Program


A typical program includes comments, imports, functions/classes, and the main code block.

Example:
print('Hello, World!')

4. Indentation
Python uses indentation to define blocks of code instead of braces.

5. Identifiers, Keywords, Constants, and Variables


Concept Meaning Example
Identifier Name for variable or function name, totalMarks
Keyword Reserved word with special meaning if, for, while
Constant Fixed value PI = 3.14
Variable Stores data value age = 17
6. Operators and Precedence
Operators perform operations on variables and values.

Type Examples Purpose


Arithmetic +, -, *, /, %, ** Math operations
Comparison ==, !=, >, < Compare values
Logical and, or, not Combine conditions
Assignment =, +=, -= Assign values
Membership in, not in Check presence
Identity is, is not Compare memory location

7. Data Types
Type Example Mutable?
int 10 No
float 10.5 No
str 'Hello' No
bool True / False No
list [1,2,3] Yes
tuple (1,2,3) No
dict {'a':1} Yes
set {1,2,3} Yes

Deep Reflection:
“Programming isn’t about typing; it’s about thinking.” Python rewards clarity and logic — the simpler
your code, the smarter your thought.

You might also like