Skip to content

Latest commit

 

History

History
330 lines (248 loc) · 9.04 KB

File metadata and controls

330 lines (248 loc) · 9.04 KB

📝 Python Basic Exams Collection

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 Information

  • 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

📋 Project Contents

This repository contains 4 progressively challenging Python exams that cover essential programming fundamentals:

📌 Exam 1: School Charity Raffle

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:

  • while loops with break statements
  • Random number generation
  • Conditional logic
  • Input validation
  • String formatting with % operator

📌 Exam 2: Store Inventory Management

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:

  • for loops
  • Functions with return values
  • Accumulator variables
  • Input validation
  • F-string formatting
  • Rounding decimal numbers

📌 Exam 3: Weekly Coffee Shop Sales Control

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:

  • for loops
  • Functions with return values
  • Multiple data tracking
  • Input validation with specific price ranges
  • .format() string formatting
  • Mathematical calculations

📌 Exam 4: Weekly Exercise Tracker

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:

  • while loops with counters
  • Functions without return (void functions)
  • Multiple conditional validations
  • String validation
  • F-string formatting
  • Statistical calculations

🎯 Learning Objectives

These exams comprehensively cover fundamental Python programming concepts:

  • Loop Control: while and for loops with proper iteration
  • Conditional Logic: if-elif-else statements and nested conditions
  • Input Validation: Comprehensive data verification with error handling
  • Functions: Both return and void functions
  • Random Numbers: Using random module 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: break statements and loop counters

📦 Requirements

Python 3.x
random module (included in standard library)

▶️ How to Run

  1. Clone this repository:
git clone https://github.com/yourusername/python-basic-exams.git
cd python-basic-exams
  1. 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

🔍 Validation Rules

Exam 1 Validations:

  • ✅ Grades: Range 1-10
  • ✅ Lucky number: Range 1-10
  • ✅ GPA requirement: ≥ 9.0

Exam 2 Validations:

  • ✅ Public price: ≥ $0.50
  • ✅ Supplier cost: ≥ $0.50
  • ✅ Product quantity: ≥ 1

Exam 3 Validations:

  • ✅ Coffee quantity: ≥ 0
  • ✅ Coffee price: ≥ $15.00
  • ✅ Dessert quantity: ≥ 0
  • ✅ Dessert price: ≥ $25.00

Exam 4 Validations:

  • ✅ Exercise duration: > 0 minutes
  • ✅ Calories burned: > 0
  • ✅ Exercise type: Must be "Cardio", "Fuerza", or "Resistencia"

📚 Learning Outcomes

This collection serves as an educational resource for understanding fundamental Python programming:

🎓 What You'll Learn

  1. Loop Mastery

    • while loops with conditions
    • for loops with range()
    • Loop counters and control variables
    • Breaking out of loops
    • Nested loop structures
  2. Input Validation Techniques

    • Range checking (numeric values)
    • String validation (specific options)
    • Re-prompting on invalid input
    • Error message display
    • Data type conversion safety
  3. Function Design

    • Functions with return values
    • Void functions (procedures)
    • Parameter passing
    • Function documentation
    • Type hints usage
  4. Mathematical Operations

    • Sum accumulation
    • Average calculation
    • Rounding decimals
    • Multiplication and division
    • Percentage calculations
  5. String Formatting

    • Old-style % formatting
    • .format() method
    • F-strings (formatted string literals)
    • Concatenation techniques
    • Output formatting
  6. Control Flow Patterns

    • Conditional execution
    • Multiple conditions (and, or)
    • Nested conditionals
    • Loop exit strategies
    • Program state management
  7. Random Number Generation

    • random.randint() usage
    • Range specification
    • Random selection logic
    • Probability concepts
  8. Data Accumulation

    • Running totals
    • Counter variables
    • Aggregation patterns
    • Statistical calculations
  9. Program Organization

    • Clear documentation
    • Logical flow structure
    • Variable naming conventions
    • Code readability
    • Comment best practices
  10. Error Handling

    • Input validation loops
    • User feedback messages
    • Graceful error recovery
    • Edge case handling

🎯 Skills Developed

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 Comparison Table

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 ⭐⭐⭐⭐

🔮 Practice Suggestions

For Beginners:

  1. Start with Exam 1 to understand basic loops and conditionals
  2. Move to Exam 2 to learn functions with return values
  3. Practice Exam 3 to master multiple data tracking
  4. Challenge yourself with Exam 4 for advanced validation

For Intermediate Learners:

  1. Modify the programs to add new features
  2. Combine concepts from multiple exams
  3. Add error handling with try-except
  4. Create GUI versions using Tkinter

Enhancement Ideas:

  • 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)

📄 License

This project is educational in nature and available for free use for learning purposes.


🤝 Contributing

Students and educators are welcome to:

  • Report issues or bugs
  • Suggest improvements
  • Share alternative solutions
  • Create additional practice problems
  • Translate to other languages

📧 Contact

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!