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

Python Programming Course Overview

The document outlines a comprehensive Python course covering fundamental concepts including printing, variables, data types, control structures, data structures, functions, file handling, error handling, modules, and object-oriented programming. It provides examples and exercises for each lesson to reinforce learning, culminating in mini projects such as a number guessing game and a to-do list application. This structured approach aims to equip learners with the skills to program in Python from scratch.

Uploaded by

thakurmayankmst
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)
5 views5 pages

Python Programming Course Overview

The document outlines a comprehensive Python course covering fundamental concepts including printing, variables, data types, control structures, data structures, functions, file handling, error handling, modules, and object-oriented programming. It provides examples and exercises for each lesson to reinforce learning, culminating in mini projects such as a number guessing game and a to-do list application. This structured approach aims to equip learners with the skills to program in Python from scratch.

Uploaded by

thakurmayankmst
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 From Scratch - Detailed Complete Course

Lesson 1: Printing, Variables & Data Types

Why: To show messages, store info, do calculations.


Examples:
print('Hello World')
name='Mayank'
age=16
print('Name:',name,'Age:',age)
x=5
y=3
print(x+y,x*y,x**y)
Input:
user_name=input('Enter name: ')
print('Hello',user_name)

Lesson 2: Strings, If-Else & Loops

Why: Strings for text, If-Else for decisions, Loops to repeat tasks.
Examples:
text='Python'
print([Link](),text[0],text[-1])
age=int(input('Age: '))
if age>=18: print('Adult') else: print('Minor')
for i in range(1,6): print(i)
x=1
while x<=5: print(x); x+=1
for i in range(1,6):
if i==3: continue
if i==5: break
print(i)

Lesson 3: Lists, Tuples, Sets & Dictionaries

Why: To store multiple items.


List example:
fruits=['apple','banana']
[Link]('mango')
print(fruits)
Tuple example:
numbers=(1,2,3)
print(numbers[0])
Set example:
u={1,2,2,3}
print(u)
Dict example:
phone={'Alice':'123','Bob':'456'}
print(phone['Alice'])

Lesson 4: Functions

Why: To reuse code.


Example:
def greet(name):
return f'Hello {name}!'
print(greet('Mayank'))
Lambda:
sq=lambda x:x*x
print(sq(5))
Lesson 5: File Handling

Why: Save and read data from files.


Write:
with open('[Link]','w') as f: [Link]('Hello')
Read:
with open('[Link]','r') as f: print([Link]())
Append:
with open('[Link]','a') as f: [Link]('New line')

Lesson 6: Error Handling (Exceptions)

Why: Prevent crashes.


Example:
try:
num=int(input())
print(num*2)
except ValueError:
print('Enter number')

Lesson 7: Modules & Libraries

Why: Use built-in or external tools.


Example:
import math
print([Link](16))
import random
print([Link](1,10))
Lesson 8: Classes & Objects (OOP)

Why: Model real-world things.


Example:
class Student:
def __init__(self,name,age):
[Link]=name
def greet(self):
print(f'Hello {[Link]}')
s1=Student('Alice',16)
[Link]()

Lesson 9: Practice Problems

Examples:
Reverse string:
word='Python'
print(word[::-1])
Count vowels:
text='Hello'
vowels='aeiou'
print(sum(1 for c in text if c in vowels))
Even numbers:
n=[1,2,3,4]
ev=[x for x in n if x%2==0]
print(ev)
Factorial:
def fact(n):
r=1
for i in range(1,n+1): r*=i
return r
print(fact(5))
Lesson 10: Mini Projects

Number guessing game:


import random
num=[Link](1,20)
guess=0
while guess!=num:
guess=int(input('Guess:'))
if guess<num: print('Too low')
elif guess>num: print('Too high')
else: print('Correct')
To-do list:
tasks={}
while True:
action=input('Add/Show/Exit:').lower()
if action=='add': task=input('Task:'); tasks[len(tasks)+1]=task
elif action=='show': print(tasks)
elif action=='exit': break

You might also like