HW02 運算子表達式

 HW02 運算子表達式 115103136余廷宥

1.NotebookLM

2.


3.學習卡和測驗


4. 寫1個程式需附加說明 Create a README For Github

Here is a complete solution featuring a clean Python script and a ready-to-use GitHub README.md file.

Python Code (main.py)

Python
def calculate_total_amount(notes_100: int, notes_500: int, notes_1000: int) -> int:
    """Calculates the total cash amount withdrawn from the ATM based on note counts."""
    return (notes_100 * 100) + (notes_500 * 500) + (notes_1000 * 1000)


def main():
    print("=== ATM Cash Withdrawal Calculator ===")
    
    try:
        notes_100 = int(input("Enter number of ₹100 notes: "))
        notes_500 = int(input("Enter number of ₹500 notes: "))
        notes_1000 = int(input("Enter number of ₹1000 notes: "))

        if notes_100 < 0 or notes_500 < 0 or notes_1000 < 0:
            print("Error: Note counts cannot be negative.")
            return

        total_amount = calculate_total_amount(notes_100, notes_500, notes_1000)
        
        print("\n--- Withdrawal Summary ---")
        print(f"₹100  notes: {notes_100} × 100  = ₹{notes_100 * 100}")
        print(f"₹500  notes: {notes_500} × 500  = ₹{notes_500 * 500}")
        print(f"₹1000 notes: {notes_1000} × 1000 = ₹{notes_1000 * 1000}")
        print(f"Total Amount Withdrawn: ₹{total_amount}")

    except ValueError:
        print("Error: Please enter valid integer numbers for note counts.")


if __name__ == "__main__":
    main()

GitHub Documentation (README.md)

Markdown
# ATM Cash Withdrawal Calculator

A simple Python application that calculates the total cash amount withdrawn from an ATM based on the user's requested count of ₹100, ₹500, and ₹1000 currency notes.

## Features

- Prompts the user to enter desired counts for ₹100, ₹500, and ₹1000 notes.
- Validates inputs to ensure non-negative integers are provided.
- Outputs an itemized breakdown of currency totals and the grand total in Indian Rupees (₹).

## Prerequisites

- **Python 3.x** installed on your system.

## How to Run

1. Clone or download this repository to your local machine:
   ```bash
   git clone [https://github.com/your-username/atm-withdrawal-calculator.git](https://github.com/your-username/atm-withdrawal-calculator.git)
   cd atm-withdrawal-calculator
  1. Run the program using Python:

    Bash
    python main.py
    

Example Usage

Plaintext

=== ATM Cash Withdrawal Calculator ===
Enter number of ₹100 notes: 3
Enter number of ₹500 notes: 2
Enter number of ₹1000 notes: 1

--- Withdrawal Summary ---
₹100  notes: 3 × 100  = ₹300
₹500  notes: 2 × 500  = ₹1000
₹1000 notes: 1 × 1000 = ₹1000
Total Amount Withdrawn: ₹2300

License

This project is open-source and available under the MIT License.


<FollowUp label="Would you like to add input validation loops or GUI support for this script?" query="Show me how to add input validation 















留言

這個網誌中的熱門文章

python作業

HW03 判斷敘述式