0% found this document useful (0 votes)
25 views5 pages

Python Course Notes CodeWithHarry

These notes provide an overview of Python programming, covering topics such as installation, data types, user input, conditional statements, loops, functions, lists, dictionaries, file handling, object-oriented programming, exception handling, and modules. Each section includes examples to illustrate the concepts. The document encourages practice through suggested projects and exercises.

Uploaded by

nakshvardhan05
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)
25 views5 pages

Python Course Notes CodeWithHarry

These notes provide an overview of Python programming, covering topics such as installation, data types, user input, conditional statements, loops, functions, lists, dictionaries, file handling, object-oriented programming, exception handling, and modules. Each section includes examples to illustrate the concepts. The document encourages practice through suggested projects and exercises.

Uploaded by

nakshvardhan05
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/ 5

Python Course Notes (CodeWithHarry)

Python Programming - CodeWithHarry (Complete Course Notes)

1. Introduction to Python

Python is an easy-to-learn, high-level programming language used for web development, data

science, AI, and more.

Key Features:

- Simple syntax similar to English.

- Interpreted language (runs line by line).

- Large community and extensive libraries.

Example:

print("Hello, World!")

2. Installing Python & Setting Up Environment

- Download Python from https://python.org.

- Install an IDE like PyCharm, VS Code, or use IDLE.

3. Variables & Data Types

Variables store data values, and Python automatically assigns the data type.

Example:

x = 10 # Integer

y = 3.5 # Float
name = "Harry" # String

is_coding = True # Boolean

4. Taking User Input

Python allows taking user input through the input() function.

Example:

name = input("Enter your name: ")

print("Hello, " + name)

5. Conditional Statements (if-elif-else)

Conditional statements help in decision-making.

Example:

age = int(input("Enter your age: "))

if age >= 18:

print("You are an adult.")

elif age > 12:

print("You are a teenager.")

else:

print("You are a child.")

6. Loops (for and while)

Loops allow executing a block of code multiple times.

For Loop Example:

for i in range(1, 6):


print(i)

While Loop Example:

x=1

while x <= 5:

print(x)

x += 1

7. Functions in Python

Functions allow code reusability and better organization.

Example:

def greet(name):

print("Hello, " + name)

greet("Harry")

8. Lists & Tuples

Lists store multiple values in one variable, while tuples are immutable.

Example:

fruits = ["Apple", "Banana", "Cherry"]

print(fruits[0]) # Output: Apple

Tuple Example:

colors = ("Red", "Green", "Blue")


9. Dictionaries

Dictionaries store data in key-value pairs.

Example:

student = {"name": "Harry", "age": 18}

print(student["name"]) # Output: Harry

10. File Handling

Python allows reading and writing files.

Example:

file = open("test.txt", "w")

file.write("Hello, Python!")

file.close()

11. Object-Oriented Programming (OOP)

OOP allows structuring code using classes and objects.

Example:

class Student:

def __init__(self, name, age):

self.name = name

self.age = age

s1 = Student("Harry", 18)

print(s1.name) # Output: Harry


12. Exception Handling (Try-Except)

Used to handle errors and prevent program crashes.

Example:

try:

x = int(input("Enter a number: "))

print(10 / x)

except ZeroDivisionError:

print("Cannot divide by zero!")

13. Modules & Libraries

Python has built-in modules and external libraries.

Example:

import math

print(math.sqrt(25)) # Output: 5.0

14. Projects & Practice Exercises

- Create a calculator program.

- Build a to-do list app.

- Develop a simple game using Pygame.

These notes summarize key topics from CodeWithHarry's Python course. Keep practicing and

happy coding!

You might also like