Skip to content

Latest commit

 

History

History
156 lines (93 loc) · 3.64 KB

README.md

File metadata and controls

156 lines (93 loc) · 3.64 KB

H9A: How Many 9 In 1 to 100 🚀

Welcome to H9A, a Python-based terminal tool that calculates how many times the digit 9 appears between 1 and 100. This project utilizes the power of Python libraries rich and pyfiglet to create a visually appealing terminal experience.


🎯 Key Features

H9A is a Python terminal tool that calculates the occurrences of the digit 9 between 1 and 100, featuring colorful banners, step-by-step explanations, and a detailed mathematical breakdown.

  1. Dynamic Banner Display:

    • Uses pyfiglet to create an artistic banner "H9A" with a sub-name "How Many 9 In 1 to 100".
  2. Step-by-Step Explanation:

    • Each step of the calculation is printed to the console for better understanding.
  3. Detailed Breakdown of the Calculation:

    • Includes how 9 appears in both the ones place and tens place.
  4. Professional Styling:

    • Utilizes the rich library for colorful and styled output, enhancing user experience.
  5. Mathematical Insights:

    • Explains the logic behind the calculations.

🛠️ Installation

Prerequisites

  • Python 3.8+
  • Install the required libraries:
    pip install rich pyfiglet

🚀 Usage

  1. Clone the repository:
    git clone https://github.com/rkstudio585/h9a.git
  2. Navigate to the project directory:
    cd h9a
  3. Run the script:
    python h9a.py

📖 How It Works

Step-by-Step Execution

  1. Banner Display:

    • The tool uses pyfiglet to render the main banner "H9A" in large ASCII art with a sub-name below it.
  2. Calculation Logic:

    • The tool calculates:
      • Ones Place: Counts how many times 9 appears as the last digit (e.g., 9, 19, 29, ...).
      • Tens Place: Counts how many times 9 appears in the tens place (e.g., 90, 91, 92, ...).
    • Combines both counts for the total.
  3. Detailed Explanation:

    • Prints a breakdown of each step and explains how the total was derived.
  4. Result Display:

    • Finally, the tool displays the total count of 9s found in the range 1 to 100.

🧮 Example Output

Here is an example of how the tool runs:

H9A
How Many 9 In 1 to 100

Calculating step by step...

Step 2: 9 appears 10 times in the ones place.
Step 3: 9 appears 9 times in the tens place.
Step 4: Total occurrences of 9 = 19.

Explanation:
1. In the ones place: The digit 9 appears in numbers like 9, 19, 29, ..., 99.
2. In the tens place: The digit 9 appears in numbers like 90, 91, 92, ..., 99.
3. Total occurrences are calculated by adding these together.

Final Result: In the range 1 to 100, the digit '9' appears 19 times!

🛡️ Why Use This Tool?

  1. Educational Value:

    • A great way to understand basic programming and mathematical concepts.
  2. Visual Appeal:

    • Makes terminal applications fun and engaging with colorful banners and styled text.
  3. Simple Yet Powerful:

    • Shows how to integrate multiple Python libraries to create a polished tool.

🤝 Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Commit your changes and submit a pull request.

📜 License

This project is licensed under the MIT License. Feel free to use, modify, and distribute as per the license.


🌟 Support

If you like this project, please give it a ⭐ on GitHub and share it with others!


👨‍💻 Author

  • Riad Khan (RK)
    Creator of H9A and founder of RK Studio.

Thank you for using H9A! 🎉 If you have any suggestions or feedback, feel free to reach out!