0% found this document useful (0 votes)
29 views6 pages

Complete Python Beginner Course

Uploaded by

sh.swastik1245
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)
29 views6 pages

Complete Python Beginner Course

Uploaded by

sh.swastik1245
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/ 6

Complete Python Beginner Course

1. Introduction to Python

Python is a high-level, easy-to-learn programming language. It's used for web

development, data science, automation, AI, and more.

Key Features:

- Simple syntax (like English)

- Huge community support

- Works on Windows, Mac, Linux

Example:

print("Hello, World!")

2. Variables and Data Types

Variables store data. Python has different types:

- String (str): "hello"

- Integer (int): 5

- Float (float): 3.14

- Boolean (bool): True / False

Example:

name = "Alice"

age = 25

height = 5.4

is_student = True

3. User Input and Output

Use input() to get user input and print() to show output.


Complete Python Beginner Course

Example:

name = input("Enter your name: ")

print("Hello, " + name)

4. Operators

Used to perform operations:

Arithmetic: + - * / % // **

Comparison: == != > < >= <=

Logical: and, or, not

Example:

a = 5

b = 3

print(a + b) # 8

5. Conditional Statements

Use if, elif, else to make decisions.

Example:

age = 18

if age >= 18:

print("Adult")

else:

print("Not an adult")

6. Loops
Complete Python Beginner Course

For repeating actions.

for loop: used with ranges or lists

while loop: runs as long as condition is true

Examples:

for i in range(3):

print(i)

x = 0

while x < 3:

print(x)

x += 1

7. Lists, Tuples, Sets, Dictionaries

- List: [1, 2, 3] (mutable, ordered)

- Tuple: (1, 2, 3) (immutable, ordered)

- Set: {1, 2, 3} (unique, unordered)

- Dictionary: {"key": "value"} (key-value pairs)

Example:

fruits = ["apple", "banana"]

person = {"name": "Alice", "age": 25}

8. Functions

Reusable blocks of code.


Complete Python Beginner Course

Example:

def greet(name):

print("Hello", name)

greet("Bob")

9. String Methods

Strings have built-in methods.

Example:

text = "hello"

print(text.upper()) # "HELLO"

print(len(text)) # 5

10. File Handling

Read/write files using open()

Example:

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

file.write("Hello!")

file.close()

11. Error Handling

Use try-except to catch errors.

Example:

try:
Complete Python Beginner Course

print(10 / 0)

except ZeroDivisionError:

print("Cannot divide by zero")

12. Object-Oriented Programming (OOP)

Use classes and objects.

Example:

class Person:

def __init__(self, name):

self.name = name

def greet(self):

print("Hi", self.name)

p = Person("Alice")

p.greet()

13. Modules and Libraries

Use import to use extra features.

Example:

import math

print(math.sqrt(16)) # 4.0

14. Practice Projects

Start small projects to practice:


Complete Python Beginner Course

- Calculator

- To-Do List

- Number Guessing Game

- Quiz App

You might also like