This repository contains a comprehensive collection of assignments, exercises, and projects completed during the Maktab Sharif Python Bootcamp (Maktab 78). It showcases progression from Python fundamentals through advanced topics including OOP, database integration, web development, and software design patterns.
- Overview
- Repository Structure
- Prerequisites & Setup
- Homework Assignments
- HWK1: Python Fundamentals
- HWK2: Functions & Functional Programming
- HWK3: Object-Oriented Programming Basics
- HWK4: File Operations & Linux Terminal
- HWK5: Design Patterns & System Processes
- HWK6: Abstract Classes & Matrix Operations
- HWK7: Bash Scripting & Serialization
- HWK8: Data Serialization with Pickle
- HWK9: Database Theory & PostgreSQL
- HWK10: Context Managers & Database Operations
- HWK11: Command-Line Arguments & Date/Time
- HWK12: Exception Handling & Data Validation
- HWK13: Frontend Development (HTML/CSS/Bootstrap)
- HWK21: Documentation Exercises
- HWK22: Flask REST API with MongoDB
- HWK_GL: Group Learning Materials
- Major Projects
- Running the Projects
- Dependencies & Requirements
- Notes & Troubleshooting
- License
This monorepo documents a complete journey through Python development, covering:
- Core Python: Data types, control flow, functions, comprehensions
- Object-Oriented Programming: Classes, inheritance, abstract base classes, design patterns
- System Programming: File I/O, serialization (pickle/dill), logging, command-line tools
- Bash Scripting: Shell scripts for automation and system management
- Database Systems: PostgreSQL (psycopg2), MongoDB (pymongo)
- Web Development: Flask REST APIs, HTML/CSS, Bootstrap
- Software Design: Singleton pattern, decorators, context managers
- Data Validation: Regular expressions, custom exceptions, type checking
- Frontend Technologies: HTML5, CSS3, Bootstrap 5
Each homework folder (HWK*) contains:
excersizes/- Completed assignment solutionsrefrences/- Course materials, PDFs, and reference documents
.
├── HWK1/ # Python basics (I/O, strings)
├── HWK2/ # Functions, map, filter, zip
├── HWK3/ # OOP basics, classes, properties
├── HWK4/ # File operations, Linux commands
├── HWK5/ # Design patterns, bash scripts
├── HWK6/ # Abstract classes, matrix operations
├── HWK7/ # Bash scripting, pickle/dill
├── HWK8/ # Pickle serialization
├── HWK9/ # Database theory (PostgreSQL)
├── HWK10/ # Context managers, database ops
├── HWK11/ # sys.argv, decorators, datetime
├── HWK12/ # Exceptions, validation, JSON/HTML
├── HWK13/ # HTML/CSS/Bootstrap frontend
├── HWK21/ # Documentation exercises
├── HWK22/ # Flask + MongoDB REST API
├── HWK_GL/ # Group learning materials
├── M78__FileStore/ # PostgreSQL file storage system
├── password_gen/ # Password generator (v1)
├── password_gen_v1/ # Advanced password generator
└── psyc/ # PostgreSQL model definitions
- Python 3.8+ (Python 3.9+ recommended)
- MongoDB (for HWK22 project)
- PostgreSQL (for M78__FileStore and psyc projects)
- pip (Python package manager)
- mongorestore utility (MongoDB Tools, for HWK22 data restoration)
-
Clone the repository:
git clone https://github.com/Raminyazdani/HW_all_maktab-78.git cd HW_all_maktab-78 -
Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install project-specific dependencies:
⚠️ Note: Severalrequirements.txtfiles in this repository are empty, corrupted, or have encoding issues. You may need to manually install dependencies based on import statements in the code.
Topics: Input/output, string manipulation, data types, basic control flow
Key Exercises:
- Practice1.py: String manipulation - Replace spaces, swap case, replace vowels with dots
- practice2.py: User input processing
- practice3.py: Basic arithmetic operations
- practice4.py: Control flow and conditionals
- practice5.py: String and character operations
Learning Outcomes: Basic Python syntax, string methods (replace(), swapcase()), user input handling with input()
Reference Materials: refrences/ contains Maktab78-HW1.pdf, PyMaktabSharif_1.pdf, PyMaktabSharif_2.pdf
Topics: Function definitions, lambda expressions, map(), filter(), zip(), list comprehensions
Key Exercises:
- EX_1.py: Temperature conversion (Celsius to Fahrenheit)
- Demonstrates function composition
- Uses
map()for batch conversion - Implements
zip()for paired output formatting
def ctof(degree: float) -> float: return ((degree * 9) / 5) + 32
- EX_2.py through EX_6.py: Various functional programming exercises
Learning Outcomes: Higher-order functions, functional programming paradigms, list transformations
Reference Materials: PyMaktabSharif_3.pdf, PyMaktabSharif_4.pdf, Maktab78-HW2.pdf
Topics: Classes, properties, decorators (@property, @classmethod), datetime operations, OOP design
Key Exercises:
-
ex1.py:
BirthDayclass - Comprehensive age calculator- Features:
- Input validation with regex (
remodule) - Calculates age (years, months, days, hours, minutes, seconds)
- Calculates time until next birthday
- Leap year detection
- Real-time countdown display
- Input validation with regex (
- Methods:
@property year_old: Returns detailed age breakdown@property to_birthday: Returns time until next birthday@classmethod check_year,check_month,check_day,check_clock: Input validators
- Demonstrates advanced OOP concepts and date/time arithmetic
- Features:
-
ex2.py: Additional OOP exercises
-
ex3-1.py, ex3-2.py: More class-based implementations
Learning Outcomes: Class design, property decorators, class methods, time module usage, validation patterns
Reference Materials: PyMaktabSharif_5.pdf, Maktab78-HW3.pdf
Topics: File I/O, text file processing, Linux command-line basics
Key Exercises:
- ex1.py: File reading and writing operations
- test.py: Testing file operations
- Linux Terminal Research: Documentation exercises on terminal commands (
.docxand.pdffiles)
Learning Outcomes: File handling, text processing, basic Linux command knowledge
Reference Materials: PyMaktabSharif_6.pdf, Maktab78-HW4.pdf (includes Linux command references)
Topics: Singleton pattern, bash scripting, process management (ps, top, kill)
Key Exercises:
-
ex1.py: Multiple Singleton pattern implementations
class SingletonClassic(object): instance = None def __new__(cls): if not hasattr(cls, 'instance'): cls.instance = super(SingletonClassic, cls).__new__(cls) return cls.instance
- Classic Singleton
- Singleton with
__new__ - Metaclass-based Singleton
- Singleton inheritance patterns
-
downloader.sh: Bash script for automated downloads
-
ex4.py: Additional scripting exercises
-
pics archive/: Downloaded content storage
-
Process Management Documentation: Research on
ps,top,killcommands (.docxand.pdf)
Learning Outcomes: Design patterns, creational patterns, bash scripting basics, Linux process management
Reference Materials: PyMaktabSharif_7.pdf, Git-1.pdf (Git version control introduction)
Topics: Abstract Base Classes (ABC), mathematical operations, OOP abstraction
Key Exercises:
-
ex1.py: Matrix operations with abstract base class
from abc import ABC, abstractmethod class BaseMatrix(ABC): @abstractmethod def present_matrix(self) -> None: return None @abstractmethod def get_matrix(self) -> None: return None
- Implements
Matrix_class with full matrix operations - Dictionary-based matrix storage:
self.matrix_dict[(h, w)] - Supports initialization from number lists
- Matrix arithmetic operations
- Implements
-
ex2.pdf: Documentation on matrix theory
Learning Outcomes: Abstract classes, abc module, mathematical algorithms, OOP abstraction patterns
Reference Materials: PyMaktabSharif_8.pdf, Maktab78-HW6.pdf
Topics: Advanced bash scripting, Python serialization (pickle, dill), logging
Key Exercises:
-
ex1.sh: File validation and content display script
check_file() { local file_name_pass=$1 if [ -f "${file_name_pass}" ]; then echo "File exists" tail -10 "${file_name_pass}" fi }
- Command-line argument handling
- File existence checks
- Line counting with
wc -l - Displays last 10 lines with
tail
-
ex2/: Port documentation exercises
-
ex3/ex3.py: User management with pickle serialization
import pickle, dill class User: def __init__(self, id, first_name, last_name, phone): # User attributes
- Loads data from
users.pickled - Regex pattern matching for phone numbers (
^0919\d{7}$) - Sorting and filtering users
- Mixed pickle/dill serialization output
- Loads data from
-
ex4/: Logging implementation
person.py: Person class with loggingsample.py: Usage examplesperson.log: Log output file
Learning Outcomes: Bash scripting, file operations, pickle/dill serialization, logging module, regex validation
Reference Materials: PyMaktabSharif_9.pdf, bash scripting guides
Topics: Python pickle module, binary serialization, data persistence
Key Exercises:
- excersizes/: Pickle serialization exercises
- numbers.pickle: Serialized data file
- Documentation exercises (
.docxfiles)
Learning Outcomes: Binary serialization, data persistence, pickle protocol understanding
Reference Materials: Pickle module documentation references
Topics: Database concepts, SQL fundamentals, PostgreSQL, normalization, ER diagrams
Key Exercises:
- Theory only - no code exercises
- Extensive reference materials for database learning
Learning Outcomes: Database design principles, SQL basics, relational database theory, normalization forms
Reference Materials:
Database-System-Concepts.pdf: Comprehensive database textbookPostgreSQLNotesForProfessionals.pdf: PostgreSQL practical guidePyMaktabSharif_10.pdf,PyMaktabSharif_db_1.pdf: Course-specific materialsMaktab78-HW9.pdf: Homework assignments
Topics: Context managers (with statement), __enter__/__exit__ methods, database connectivity
Key Exercises:
-
ex1.py:
Indentercontext managerclass Indenter: def __init__(self): self.indented = -1 def __enter__(self): self.indented += 1 return self def __exit__(self, exc_type, exc_value, exc_tb): self.indented -= 1 def print(self, text): print(" " * self.indented + text)
- Nested context manager usage
- Automatic indentation management
-
ex2.py: Additional context manager patterns
-
ex3.py: Database connectivity exercises
-
ex4/: SQL query exercises
ERD.png: Entity-Relationship Diagramqueries.docx: SQL query documentation
-
log_cache.txt: Cached operation logs
Learning Outcomes: Context managers, resource management, with statement protocol, database connections
Reference Materials: PyMaktabSharif_11.pdf, PyMaktabSharif_db_2.pdf, Maktab78-HW10.pdf
Topics: sys.argv, argparse, decorators, datetime, jdatetime (Jalali calendar)
Key Exercises:
-
ex1.py: Command-line average calculator
import sys numbers = sys.argv numbers = list(map(lambda x: float(x), numbers[1:])) print(sum(numbers) / len(numbers))
- Processes command-line arguments
- Type conversion and error handling
-
ex2.py: Decorator implementations
-
ex3.py: Advanced datetime operations
import datetime, jdatetime def seconds_between(date1, date2): return abs((date1 - date2).total_seconds()) def is_leap(year): return ((year % 400 == 0) or ((year % 100 != 0) and (year % 4 == 0)))
- Date parsing with
strptime - Leap year detection
- Clock change calculations
- Jalali calendar support
- Date parsing with
-
ex4.py: Guessing game with
argparseparser = argparse.ArgumentParser(description="guessing game") parser.add_argument("guessing_game", type=int) parser.add_argument("-g", "--guess", type=int, required=False) parser.add_argument("-s", "--start", type=int, default=0) parser.add_argument("-e", "--end", type=int, default=100)
- Interactive number guessing
- Command-line argument parsing
- Range validation
-
ex5.py: Weekday generator
def generate_days(start_time, end_time, day): temp = start_time while temp <= end_time: if temp.weekday() == day: yield temp temp += datetime.timedelta(days=1)
- Generator functions with
yield - Date range iteration
- Weekday filtering
- Generator functions with
Learning Outcomes: Command-line tools, sys.argv, argparse module, datetime arithmetic, generators, Jalali calendar, decorators
Dependencies: jdatetime==4.1.0 (Persian calendar support)
Reference Materials: PyMaktabSharif_12.pdf, Maktab78-HW11.pdf
Topics: Custom exceptions, regex validation, JSON/HTML generation, data serialization
Key Exercises:
-
ex1.py: Comprehensive validation system
class ValidationError(Exception): def __init__(self, message, value=None): self.message = message self.value = value class NameValidationError(ValidationError): pass class PhoneValidationError(ValidationError): pass class EmailValidationError(ValidationError): pass def name_validation(name): # Validates: 4 <= len <= 14, only ascii_letters or '_' pattern = r"^[a-zA-Z_]{4,14}$" return bool(re.match(pattern, name))
- Custom exception hierarchy
- Regex-based validation (name, phone, email)
- Non-regex validation alternatives
-
ex2.py: Data transformation exercises
-
ex3.py: JSON processing
-
ex4.py: Complex data validation
-
ex4_JSON_time.json: JSON output with timestamp
-
ex5.html: HTML generation
-
asghar.json: Sample JSON data
-
IMG_5283.jpg: Image asset
Learning Outcomes: Exception handling, custom exceptions, regex patterns, JSON serialization, HTML generation, data validation strategies
Reference Materials: PyMaktabSharif_13.pdf, PyMaktabSharif_Front_HTML.pdf, PyMaktabSharif_Front_CSS_1.pdf, Maktab78-HW12.pdf, Portfolio.pdf
Topics: HTML5, CSS3, Bootstrap 5, responsive design, frontend frameworks
Key Exercises:
- ex1.index.html: HTML page implementation
- bootstrap/bootstrap-5.2.0-dist/: Complete Bootstrap 5.2.0 framework
- Full CSS and JS bundles
- Icons and utilities
- Responsive grid system
- IMG_5283.jpg: Image assets
Learning Outcomes: HTML structure, CSS styling, Bootstrap components, responsive design, frontend best practices
Reference Materials:
PyMaktabSharif_Front_CSS_2.pdf: Advanced CSSPyMaktabSharif_Front_bootstrap.pdf: Bootstrap framework guideMaktab78-HW13.pdf: Assignment detailsPortfolio.jpeg: Portfolio design reference
Topics: Technical documentation, written communication
Key Files:
- hw21.docx: Original homework documentation
- hw21_edited.docx: Edited version
Learning Outcomes: Technical writing, documentation standards, editing skills
Major Project - Transaction aggregation and analysis REST API
Topics: Flask, Flask-RESTful, MongoDB, pymongo, aggregation pipelines, caching
HWK22/
├── app.py # Flask application entry point
├── core/
│ ├── model_query_aggregate/
│ │ └── aggregate_query.py # MongoDB aggregation builder
│ └── utils/
│ ├── initial_model.py # DB initialization & mongorestore
│ └── query_machine.py # Query utilities
├── templates/
│ └── home.html # Frontend template
└── static/ # Static assets (CSS, JS, images)
├── Loading_icon.gif
├── callender/ # Calendar widget
└── main/ # Main assets (TinyMCE, etc.)
-
REST API Endpoints:
GET /- Renders home page (home.html)POST /transaction/- Compute aggregation with parametersGET /transaction/- Retrieve last computed resultsGET /merchants/- List all merchant IDs
-
Query Parameters (via
reqparse):user(str): Filter by merchant IDsort(str): Sort order ("1" ascending, "-1" descending)currency(str): "rial" or "toman" (divides by 10 for toman)time_type(str): Grouping - "none", "year", "month", "week", "day"start_time(str): Start datetime (format:yyyy-mm-dd-h-m-s-ms)end_time(str): End datetime (same format)
-
MongoDB Aggregation:
- Pipeline construction in
aggregate_query.py - Supports complex filtering, grouping, and sorting
- Currency conversion (rial ↔ toman)
- Time-based aggregations
- Pipeline construction in
-
Query Caching:
- Caches aggregation results in MongoDB collection
transactions_test_cache - Cache key: SHA256 hash of aggregation pipeline
- Avoids redundant expensive queries
- Caches aggregation results in MongoDB collection
-
Database Initialization:
- Checks for DB
transactions_test - If missing, attempts to restore from
transaction.bsonusingmongorestore - Important:
transaction.bsonmust be in current working directory - Requires:
mongorestorecommand in PATH
- Checks for DB
cd HWK22
# Ensure MongoDB is running
# mongod --dbpath /path/to/data
# If transaction.bson is available:
# Place it in HWK22/ directory
# It will be auto-restored on first run
# Run the Flask app
python app.py
# Access at: http://127.0.0.1:5000/Example API Usage:
# Get merchant list
curl http://127.0.0.1:5000/merchants/
# Post query with parameters
curl -X POST http://127.0.0.1:5000/transaction/ \
-d "user=merchant_123" \
-d "sort=1" \
-d "currency=toman" \
-d "time_type=month" \
-d "start_time=2021-01-01-0-0-0-0" \
-d "end_time=2022-12-31-23-59-59-999"
# Get last results
curl http://127.0.0.1:5000/transaction/Dependencies:
- Flask
- Flask-RESTful
- pymongo
- MongoDB Tools (for mongorestore)
Database Schema:
- Database:
transactions_test - Collection:
transaction(main data) - Collection:
transactions_test_cache(query cache)
Learning Outcomes: REST API design, Flask framework, MongoDB operations, aggregation pipelines, caching strategies, API parameter parsing
Topics: Collaborative learning resources
Key Files:
- GL-W4.pdf: Week 4 group learning materials
- GL-W6.pdf: Week 6 group learning materials
- GL-W7.pdf: Week 7 group learning materials
- GL-W8.pdf: Week 8 group learning materials
Learning Outcomes: Peer collaboration, group study techniques
Major Project - Database-backed file storage system with ORM-like abstraction
Topics: PostgreSQL, psycopg2, ORM design, database abstraction layer, MVC pattern
M78__FileStore/
├── main.py # Application entry point
├── routes.py # Route definitions
├── configs.py # Database configuration
├── core/
│ ├── models.py # Base DBModel abstract class
│ ├── managers.py # DBManager for CRUD operations
│ ├── query.py # SQL query builders
│ ├── router.py # Routing logic
│ └── utils.py # Validation utilities (descriptors)
├── users/
│ └── models.py # User model
├── file/
│ └── models.py # Files model
├── comment/
│ └── models.py # Comment model
├── order_cart/
│ └── models.py # Order_cart model
├── order_item/
│ └── models.py # Order_item model
└── public/ # Public file storage
-
Custom ORM Layer:
DBModelabstract base class for all models- Automatic table creation from model definitions
- CRUD operations via
DBManager - Property descriptors for validation
-
Models:
- User:
first_name,last_name,username,email,phone,national_id,age,password - Files: File metadata (
file_name,username,file_path,description) - Comment: User comments on files
- Order_cart: Shopping cart implementation
- Order_item: Individual cart items
- User:
-
Validation Utilities (
core/utils.py):- Python descriptors for data validation
First_name,Last_name,User_name,Email,Phone,National_id,Age,Password- Automatic validation on attribute assignment
-
Database Manager (
core/managers.py):class DBManager: def __init__(self, db_name): # Connects to PostgreSQL database def insert_table(self, model_instance): # Inserts model instance into DB def read(self, model_class): # Reads all records from model table
File: configs.py
DB_CONNECTION = {
'HOST': 'localhost',
'USER': 'postgres',
'PORT': 5432,
'PASSWORD': 'your_password' # Update with actual password
}cd M78__FileStore
# Ensure PostgreSQL is running
# sudo service postgresql start
# Update configs.py with your PostgreSQL credentials
# Run the application
python main.pyExample Usage (from main.py):
from core.managers import DBManager
from users.models import User
from file.models import Files
DB = DBManager("test") # Connects to 'test' database
# Insert a user
user = User("ramin", "yazdani", "ramin_yz",
"yazdani76ramin@gmail.com", "09124981090",
"0020349629", "24", "RAmin@12345")
DB.insert_table(user)
# Read all users
users = DB.read(User)
print("Users:", users)
# Insert a file
file = Files("ketab", "ramin_yz", "C://desktop/", "ketabe darsi")
DB.insert_table(file)Dependencies:
psycopg2orpsycopg2-binary- PostgreSQL database server
Note: requirements.txt is empty. Install dependencies manually:
pip install psycopg2-binaryLearning Outcomes: Database abstraction, ORM design, PostgreSQL connectivity, descriptor protocol, MVC architecture, SQL query building
Major Project - Feature-rich command-line password generation tool
Topics: argparse, CLI design, logging, password security, itertools
-
Command-Line Interface:
- Unique prefix chars:
-,+,/(non-standardargparseusage) - Argument groups and mutually exclusive options
- Complex argument validation
- Unique prefix chars:
-
Arguments:
-w/--words: List of characters to use in password-o/--output: Output file (append mode)-l/--length: Password length range (min, max)-t/--testWords: Starting characters (prefix)- Mutually exclusive group:
-L: Boolean flag (default False)+L: Boolean flag (True)/L N: Integer value
-
Password Generation:
- Random character selection from allowed character set
- Supports custom word lists
- Length randomization within specified range
- Prefix/suffix support via
testWords - Seeded randomization for reproducibility
-
Logging:
logger = logging.getLogger("password_logger") file_handler = logging.FileHandler("password.log", "a", encoding="utf-8") logger.setLevel(logging.DEBUG)
- Comprehensive logging to
password.log - Error tracking for invalid arguments
- Logs all password generation events
- Comprehensive logging to
-
Custom Exceptions:
ArgumentTypeErrorRange: Invalid length rangeArgumentTypeErrorPasswords: Invalid characters in word listArgumentTypeErrorStartWords: Prefix too longArgumentTypeErrorFreq: Invalid frequency value
-
Validation:
- Ensures characters are in allowed set:
string.ascii_letters + string.digits + "!@#$%^&*()" - Validates length ranges
- Checks prefix length against max password length
- Ensures characters are in allowed set:
cd password_gen_v1
# Basic usage
python program.py
# With arguments (examples based on code structure)
python program.py -w a b c d 1 2 3 -l 8 16
python program.py -t a b c -l 10 20 -o password.txtOutput Files:
password.log: Detailed execution logpassword.txt: Generated passwords (if-ospecified)
Dependencies:
quantumrandom==1.9.0(noted in corruptedrequirements.txt)- Standard library:
argparse,itertools,random,string,logging
Note: requirements.txt appears corrupted (encoding issues). Install manually:
pip install quantumrandomLearning Outcomes: Advanced CLI design, argparse customization, logging best practices, password generation algorithms, exception handling
Topics: Password generation (earlier version)
Structure:
password_gen/
└── password_gen/ # Project directory
Learning Outcomes: Basic password generation concepts
Topics: PostgreSQL, psycopg2, database modeling, UUID generation
File: database_psycopg2/models.py
-
Database Connection:
import psycopg2, getpass password = getpass.getpass(prompt='Enter your password:') con = psycopg2.connect(dbname="models_test", user="postgres", password=password)
- Secure password entry (not echoed to terminal)
- Auto-commit enabled
-
Dynamic Table Creation:
def create_table(cursor, instance): query = f"Create Table {instance.__class__.__name__} (" for column, data_type in postgresql_table_data_names_types: query += f"{column} {data_type}," query = query[:-1] + ");" cursor.execute(query)
- Automatically creates tables from model instances
- Checks for table existence before creation
-
Model Definition:
class Student: postgresql_table_data_types = [ "VARCHAR(32)", "VARCHAR(32)", "INTEGER", "VARCHAR(64)", "VARCHAR(64)", "UUID NOT NULL" ] def __init__(self, name, surname, age, national_id, degree): self.name = name self.surname = surname self.age = age self.national_id = national_id self.degree = degree self.id = generate_uuid()
- UUID primary keys via
uuid4() - Type annotations for PostgreSQL
- Automatic ID generation
- UUID primary keys via
-
CRUD Operations:
not_exist(): Check table existencecreate_table(): Create table from instanceinsert_instance(): Insert data into tableinsert_into(): Combined check and insert
cd psyc/database_psycopg2
# Ensure PostgreSQL is running with database 'models_test'
# sudo service postgresql start
# psql -U postgres -c "CREATE DATABASE models_test;"
# Run the models script
python models.py
# Enter PostgreSQL password when promptedDependencies:
psycopg2orpsycopg2-binary- PostgreSQL server with
models_testdatabase
Learning Outcomes: PostgreSQL connectivity, UUID generation, dynamic SQL query building, secure credential handling, ORM patterns
cd HWK22
# Ensure MongoDB is running and transaction.bson is in this directory
python app.py
# Visit http://127.0.0.1:5000/cd M78__FileStore
# Update configs.py with PostgreSQL credentials
pip install psycopg2-binary
python main.pycd password_gen_v1
pip install quantumrandom
python program.pycd psyc/database_psycopg2
# Ensure database 'models_test' exists
python models.py# Navigate to specific homework folder
cd HWK3/excersizes
python ex1.py # Run birthday calculator
cd ../../HWK7/excersizes
bash ex1.sh filename.txt # Run bash script
cd ../../HWK11/excersizes
python ex4.py 50 -s 1 -e 100 # Guessing gameFor comprehensive project support, install:
pip install flask flask-restful pymongo psycopg2-binary jdatetime quantumrandom| Project | Dependencies | Notes |
|---|---|---|
| HWK11 | jdatetime==4.1.0 |
Jalali calendar support |
| HWK22 | flask, flask-restful, pymongo |
Requires MongoDB server |
| M78__FileStore | psycopg2-binary |
Requires PostgreSQL server |
| password_gen_v1 | quantumrandom==1.9.0 |
Quantum random number generation |
| psyc | psycopg2-binary |
Requires PostgreSQL server |
-
Empty/Corrupted Requirements Files:
M78__FileStore/requirements.txt: Emptypassword_gen_v1/requirements.txt: Encoding issuesHWK11/requirements.txt: Encoding issues
Solution: Install dependencies manually based on import statements
-
Virtual Environments Committed:
- Several folders contain committed
venv/directories - These should be excluded from version control
- Recommended: Add to
.gitignore:venv/ venve/ __pycache__/ *.pyc .idea/
- Several folders contain committed
-
Database Requirements:
- MongoDB: Required for HWK22
- PostgreSQL: Required for M78__FileStore, psyc
- Ensure database servers are running before executing projects
Error: MongoClient connection failed
Solution:
# Start MongoDB server
mongod --dbpath /path/to/data/db
# If transaction.bson restore fails:
# Ensure mongorestore is in PATH
# Place transaction.bson in HWK22/ directory
# The app will auto-restore on startupError: Connection refused / authentication failed
Solution:
- Update
configs.pywith correct credentials - Ensure PostgreSQL is running:
sudo service postgresql start
- Create database if needed:
psql -U postgres -c "CREATE DATABASE test;"
Error: ModuleNotFoundError: No module named 'quantumrandom'
Solution:
pip install quantumrandomError: ModuleNotFoundError: No module named 'jdatetime'
Solution:
pip install jdatetime-
Use Virtual Environments:
python -m venv venv source venv/bin/activate # Linux/Mac venv\Scripts\activate # Windows
-
Check Python Version:
- Minimum: Python 3.8
- Recommended: Python 3.9+
python --version
-
Inspect Code for Dependencies:
- Check
importstatements at top of files - Install missing packages as needed
- Check
-
Database Setup:
- Ensure database servers are properly configured
- Check connection parameters in config files
- Verify database/collection/table names
- HWK22: Requires
transaction.bsonfile for data restoration (not included in repo) - HWK7/ex3: Requires
users.pickledfile (not included in repo) - Bash Scripts: May need execution permissions (
chmod +x script.sh)
This project is an educational portfolio. No explicit license is provided. All code is for learning and demonstration purposes.
Recommendation: If sharing publicly, consider adding an open-source license (e.g., MIT, Apache 2.0).
This repository represents the complete coursework from Maktab Sharif's Python Bootcamp (Maktab 78), covering:
- 13 weekly homework assignments
- 4 major projects
- Database integration (MongoDB, PostgreSQL)
- Web development (Flask REST APIs)
- Frontend technologies (HTML/CSS/Bootstrap)
- Software engineering practices (OOP, design patterns, testing)
Instructor Materials: Each homework includes PDF references from course instructors (PyMaktabSharif_*.pdf series)
For questions or collaboration opportunities:
- Repository: Raminyazdani/HW_all_maktab-78
- Email: yazdani76ramin@gmail.com (from M78__FileStore/main.py)
- Username: ramin_yz
- Maktab Sharif for providing comprehensive Python education
- Instructors for detailed course materials and guidance
- Bootcamp Cohort (Maktab 78) for collaborative learning
Last Updated: December 2024
Repository Status: ✅ Complete - All bootcamp assignments and projects included
Total Exercises: 60+ Python exercises, 4 major projects, extensive reference materials
This README provides comprehensive documentation of the entire repository. For specific implementation details, refer to individual homework folders and project directories.