A collection of 4 fundamental Python programming exams that demonstrate core programming concepts including loops, functions, input validation, and data processing. These exams were completed as part of the programming fundamentals course at CBTis No. 128.
- Student: Magallanes Lรณpez Carlos Gabriel
- Email: cgmagallanes23@gmail.com
- School: Centro de Bachillerato Tecnolรณgico Industrial y de Servicios No. 128
- Completion Dates: October 22-27, 2025
This repository contains 4 progressively challenging Python exams that cover essential programming fundamentals:
Date: October 22, 2025
A raffle program that selects a winner from 5 participants based on academic performance and random number matching.
Features:
- Student eligibility verification (minimum 9.0 GPA)
- Random number generation and matching
- Input validation for grades (1-10 range)
- Lucky number validation (1-10 range)
- Winner announcement with string concatenation
Concepts Covered:
whileloops withbreakstatements- Random number generation
- Conditional logic
- Input validation
- String formatting with
%operator
Date: October 23, 2025
An inventory system that tracks 10 products and calculates the average cost per product from supplier.
Features:
- Product registration (name, public price, supplier cost, quantity)
- Total acquisition cost calculation
- Average cost per product computation
- Input validation for prices and quantities
- Function with return value
Concepts Covered:
forloops- Functions with return values
- Accumulator variables
- Input validation
- F-string formatting
- Rounding decimal numbers
Date: October 27, 2025
A sales tracking system for a coffee shop that registers daily sales for 7 days and calculates average daily income.
Features:
- Daily sales registration (coffee and desserts)
- Quantity and price tracking
- Total weekly income calculation
- Average daily income computation
- Input validation for quantities and minimum prices
Concepts Covered:
forloops- Functions with return values
- Multiple data tracking
- Input validation with specific price ranges
.format()string formatting- Mathematical calculations
Date: October 27, 2025
A fitness tracking program that records 3 exercise sessions and displays a comprehensive summary.
Features:
- Exercise session registration (type, duration, calories)
- Exercise type validation (Cardio/Strength/Resistance)
- Total minutes and calories tracking
- Average calories per session calculation
- Formatted summary display
Concepts Covered:
whileloops with counters- Functions without return (void functions)
- Multiple conditional validations
- String validation
- F-string formatting
- Statistical calculations
These exams comprehensively cover fundamental Python programming concepts:
- โ
Loop Control:
whileandforloops with proper iteration - โ
Conditional Logic:
if-elif-elsestatements and nested conditions - โ Input Validation: Comprehensive data verification with error handling
- โ Functions: Both return and void functions
- โ
Random Numbers: Using
randommodule for number generation - โ
String Formatting:
%,.format(), and f-strings - โ Mathematical Operations: Averages, totals, and rounding
- โ Accumulator Pattern: Tracking sums and counts
- โ
Data Type Conversion:
int(),float(),str() - โ
Control Flow:
breakstatements and loop counters
Python 3.x
random module (included in standard library)- Clone this repository:
git clone https://github.com/yourusername/python-basic-exams.git
cd python-basic-exams- Run any exam:
python Ex_1.py # School Charity Raffle
python Ex_2.py # Store Inventory Management
python Ex_3.py # Coffee Shop Sales Control
python Ex_4.py # Weekly Exercise Tracker- โ Grades: Range 1-10
- โ Lucky number: Range 1-10
- โ GPA requirement: โฅ 9.0
- โ Public price: โฅ $0.50
- โ Supplier cost: โฅ $0.50
- โ Product quantity: โฅ 1
- โ Coffee quantity: โฅ 0
- โ Coffee price: โฅ $15.00
- โ Dessert quantity: โฅ 0
- โ Dessert price: โฅ $25.00
- โ Exercise duration: > 0 minutes
- โ Calories burned: > 0
- โ Exercise type: Must be "Cardio", "Fuerza", or "Resistencia"
This collection serves as an educational resource for understanding fundamental Python programming:
-
Loop Mastery
whileloops with conditionsforloops with range()- Loop counters and control variables
- Breaking out of loops
- Nested loop structures
-
Input Validation Techniques
- Range checking (numeric values)
- String validation (specific options)
- Re-prompting on invalid input
- Error message display
- Data type conversion safety
-
Function Design
- Functions with return values
- Void functions (procedures)
- Parameter passing
- Function documentation
- Type hints usage
-
Mathematical Operations
- Sum accumulation
- Average calculation
- Rounding decimals
- Multiplication and division
- Percentage calculations
-
String Formatting
- Old-style
%formatting .format()method- F-strings (formatted string literals)
- Concatenation techniques
- Output formatting
- Old-style
-
Control Flow Patterns
- Conditional execution
- Multiple conditions (
and,or) - Nested conditionals
- Loop exit strategies
- Program state management
-
Random Number Generation
random.randint()usage- Range specification
- Random selection logic
- Probability concepts
-
Data Accumulation
- Running totals
- Counter variables
- Aggregation patterns
- Statistical calculations
-
Program Organization
- Clear documentation
- Logical flow structure
- Variable naming conventions
- Code readability
- Comment best practices
-
Error Handling
- Input validation loops
- User feedback messages
- Graceful error recovery
- Edge case handling
By studying and practicing with these exams, you will gain hands-on experience with:
โ
Iterative programming with loops and counters
โ
Data validation and input sanitization
โ
Function decomposition for code reusability
โ
Mathematical problem-solving in programming
โ
String manipulation and formatting techniques
โ
Algorithmic thinking for business logic
โ
Code documentation and professional standards
This repository is perfect for students learning Python fundamentals, preparing for programming exams, or anyone wanting to understand essential programming patterns through practical exercises.
| Exam | Loop Type | Function Type | Validation Count | Output Format | Difficulty |
|---|---|---|---|---|---|
| 1 - Raffle | while + break |
None | 4 validations | % operator |
โญโญ |
| 2 - Inventory | for |
Return value | 3 validations | F-string | โญโญโญ |
| 3 - Coffee Shop | for |
Return value | 4 validations | .format() |
โญโญโญ |
| 4 - Exercise | while |
Void function | 3 validations | F-string | โญโญโญโญ |
- Start with Exam 1 to understand basic loops and conditionals
- Move to Exam 2 to learn functions with return values
- Practice Exam 3 to master multiple data tracking
- Challenge yourself with Exam 4 for advanced validation
- Modify the programs to add new features
- Combine concepts from multiple exams
- Add error handling with try-except
- Create GUI versions using Tkinter
- Add data persistence (save to file)
- Create classes for better organization
- Implement unit tests
- Add command-line arguments
- Create database integration
- Build GUI interfaces
- Add data export (CSV, JSON)
This project is educational in nature and available for free use for learning purposes.
Students and educators are welcome to:
- Report issues or bugs
- Suggest improvements
- Share alternative solutions
- Create additional practice problems
- Translate to other languages
Carlos Gabriel Magallanes Lรณpez
Email: cgmagallanes23@gmail.com
School: CBTis No. 128
โญ If these exams helped you learn Python fundamentals, please give this repository a star!
๐ Happy Learning and Good Luck with Your Studies!