Skip to content

saileshvyas/my-first-python-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

🎓 Grades Generator App

A Python-based grade calculator that converts exam scores to letter grades with beautiful color-coded output. This project represents my first major programming milestone after 13 days of intensive Python learning!

📋 Project Overview

This application allows students to:

  • Input their subject name and exam scores
  • Calculate percentage marks with precision (rounded to 2 decimal places)
  • Receive color-coded letter grades for instant visual feedback
  • Experience a user-friendly interface with clear instructions

🚀 Key Features

Core Programming Concepts Applied:

  • Variables & Data Types: String, integer, and float handling
  • User Input: Interactive prompts for subject and score entry
  • Mathematical Operations: Percentage calculations with proper rounding
  • Conditional Logic: Comprehensive if/elif/else statements for grade assignment
  • Type Conversion: Converting user input to appropriate data types
  • Variable Reassignment: Efficient code structure for calculations
  • Comments: Well-documented code for clarity and maintenance

Enhanced Features:

  • Full Color-Coded Grades: Complete visual feedback system with ANSI color codes for all grade levels
  • User Experience: Welcome message and clear instructions
  • Input Validation: Structured approach to handle user data
  • Error Handling & Exception Management: Defensive programming with comprehensive fallback logic
  • Code Documentation: Comprehensive comments explaining logic and approach
  • Progressive Problem-Solving: Growing expertise in anticipating and handling edge cases

🎨 Grade Scale & Color Coding

Percentage Grade Color
90-100% A+ 🔵 Blue
80-89% A 🔷 Cyan
70-79% B 🟢 Green
60-69% C 🟡 Yellow
50-59% D 🟣 Magenta
Below 50% U 🔴 Red

💻 How to Run

  1. Ensure you have Python 3.10+ installed
  2. Clone this repository
  3. Run the program:
    python main.py
  4. Follow the prompts to enter:
    • Subject name
    • Maximum possible marks
    • Your actual marks
  5. View your percentage and color-coded grade!

🧠 Learning Journey (Days 1-13)

Fundamental Concepts Mastered:

  • Day 1-2: Print statements, variables, and basic input/output
  • Day 3-4: String concatenation, f-strings, and data type conversions
  • Day 5-6: Conditional statements and logical operators
  • Day 7-8: Loops (while and for) and list manipulation
  • Day 9-10: Functions, parameters, and return values
  • Day 11-12: Local vs global variables and advanced function concepts
  • Day 13: Real-world application development (this project!)

Technical Highlights:

  • Float Precision: Proper handling of decimal calculations for accurate percentages
  • Variable Reassignment: Efficient use of the same variable for calculation and rounding
  • Modular Logic: Clean separation of input, calculation, and output phases
  • User-Centric Design: Clear prompts and informative output messages
  • Color Implementation: ANSI escape codes for enhanced visual feedback
  • Error Handling Strategy: Implementing fallback else statements for unexpected scenarios
  • Edge Case Management: Building defensive code that gracefully handles invalid inputs

🛡️ Error Handling & Problem-Solving Development

One of the most valuable skills I'm developing is error and exception handling - a critical foundation for robust programming:

Defensive Programming Approach:

  • Fallback Logic: Implemented comprehensive else statement to catch unexpected percentage ranges
  • Input Validation Mindset: Growing awareness of potential user input variations
  • Graceful Error Messages: User-friendly feedback when calculations can't be processed
  • Edge Case Consideration: Thinking through scenarios like negative marks or impossible percentages

Problem-Solving Evolution:

This steady progression in error handling demonstrates:

  • Anticipatory Thinking: Considering what could go wrong before it happens
  • User Experience Focus: Ensuring the app doesn't crash but provides helpful feedback
  • Code Reliability: Building applications that handle unexpected scenarios gracefully
  • Professional Standards: Developing habits that lead to production-ready code

The ability to think through potential failures and handle them elegantly is what separates functional code from professional-grade applications. This skill will be invaluable as I tackle more complex programming challenges!

🎯 Code Structure

# Welcome and instructions
print("Welcome message and app description")

# User input collection
subject = input("Please type the subject: ")
maxMarks = int(input("Maximum marks: "))
myMarks = int(input("Your marks: "))

# Percentage calculation with proper rounding
percentageMarks = float((myMarks / maxMarks) * 100)
percentageMarks = round(percentageMarks, 2)

# Grade assignment with full color coding
if percentageMarks < 50:
    print("Grade: U (Red)")
elif percentageMarks >= 50 and percentageMarks <= 59:
    print("Grade: D (Magenta)")
# ... and so on for all grade ranges

🏆 Personal Reflection

What I've Learned:

The past two weeks have been transformative. Starting from absolute basics, I've gained confidence in:

  • Writing clean, readable code with proper comments
  • Debugging and refining logic through iteration
  • Understanding how different programming concepts work together
  • Building something functional and useful from scratch
  • Developing error handling intuition - slowly and steadily building this crucial skill
  • Thinking like a problem-solver who anticipates potential issues before they occur

Key Achievements:

  • ✅ Mastered fundamental Python syntax and concepts
  • ✅ Successfully implemented conditional logic for real-world scenarios
  • ✅ Applied mathematical operations and data type conversions
  • ✅ Created user-friendly interfaces with clear input/output
  • ✅ Added creative enhancements beyond basic requirements
  • ✅ Developed problem-solving confidence through hands-on coding
  • Growing expertise in error handling and exception management
  • Building defensive programming habits for robust applications

The Journey Continues:

This project marks not just the end of my first 13 days, but the beginning of an exciting journey. I feel a genuine sense of achievement in mastering these fundamental concepts, and I'm energized for the next 20 days of learning.

Onwards and upwards! 🚀

The foundation is solid, the passion is ignited, and the path forward is clear. Each line of code brings new understanding, and every challenge conquered builds confidence for the next milestone.

🔧 Technologies Used

  • Python 3.10+
  • ANSI Color Codes for terminal output styling
  • Built-in Functions: input(), print(), int(), float(), round()
  • Control Structures: if/elif/else conditional statements
  • Mathematical Operators: Division, multiplication, comparison operators

📈 Future Enhancements

Potential improvements for version 2.0:

  • Input validation for negative numbers
  • Support for multiple subjects
  • Grade point average (GPA) calculations
  • Save results to file
  • Graphical user interface (GUI)
  • Error handling for invalid input types

This project represents my first major programming milestone - a testament to the power of consistent daily learning and hands-on practice. Here's to many more coding adventures ahead! 🎉

Releases

No releases published

Packages

No packages published

Languages