0% found this document useful (0 votes)
2 views3 pages

Python Beginner Notes 11 Pages

This document provides beginner notes on Python, covering its introduction, installation, and basic programming concepts. Key topics include variables, data types, conditional statements, loops, functions, lists, tuples, dictionaries, exception handling, and file handling. Each section includes examples to illustrate the concepts discussed.

Uploaded by

dekija2631
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)
2 views3 pages

Python Beginner Notes 11 Pages

This document provides beginner notes on Python, covering its introduction, installation, and basic programming concepts. Key topics include variables, data types, conditional statements, loops, functions, lists, tuples, dictionaries, exception handling, and file handling. Each section includes examples to illustrate the concepts discussed.

Uploaded by

dekija2631
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
You are on page 1/ 3

Python Beginner Notes

1. Introduction to Python

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

multiple programming paradigms and is widely used in web development, automation, data science, and

more.

2. Python Installation

You can install Python from the official site (python.org). Use 'python --version' to verify installation. You can

run Python files with 'python filename.py'.

3. Hello World Program

Example:

print('Hello, World!')

This prints the string to the console.

4. Variables and Data Types

Variables store data. Python is dynamically typed.

Examples:

name = 'Alice' (str)

age = 25 (int)

is_valid = True (bool)

5. Conditional Statements

Use if, elif, and else to control flow:

if age > 18:

print('Adult')

elif age == 18:

print('Just became adult')

else:

print('Minor')
Python Beginner Notes

6. Loops

Python supports for and while loops:

for i in range(5):

print(i)

while count < 5:

count += 1

7. Functions

Functions are defined using def keyword:

def greet(name):

return 'Hello ' + name

8. Lists and Tuples

Lists are mutable, tuples are immutable.

Examples:

fruits = ['apple', 'banana']

coords = (10, 20)

9. Dictionaries

Store key-value pairs:

student = {'name': 'John', 'age': 20}

Access with student['name']

10. Exception Handling

Use try-except blocks:

try:

x = 10 / 0

except ZeroDivisionError:
Python Beginner Notes

print('Cannot divide by zero')

11. File Handling

To read/write files:

f = open('file.txt', 'r')

data = f.read()

f.close()

You might also like