{"id":20438696,"url":"https://github.com/anurag1101/complex_calc","last_synced_at":"2025-06-29T23:38:23.183Z","repository":{"id":258600004,"uuid":"867504763","full_name":"Anurag1101/Complex_Calc","owner":"Anurag1101","description":"The Complex Calculator is a Python application for performing arithmetic operations on complex numbers, including addition, subtraction, multiplication, and division. It uses object-oriented programming to encapsulate complex number properties and supports dynamic user input.","archived":false,"fork":false,"pushed_at":"2024-12-20T14:38:19.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-29T23:38:21.736Z","etag":null,"topics":["abstraction","complex-numbers","encapsulation","oops-in-python","python","python-script","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Anurag1101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-04T07:34:52.000Z","updated_at":"2024-12-20T14:38:22.000Z","dependencies_parsed_at":"2025-01-15T19:11:09.835Z","dependency_job_id":"1f5b16f2-d4b5-4a30-86f4-26c02e3f666b","html_url":"https://github.com/Anurag1101/Complex_Calc","commit_stats":null,"previous_names":["anurag1101/complex_calc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Anurag1101/Complex_Calc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anurag1101%2FComplex_Calc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anurag1101%2FComplex_Calc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anurag1101%2FComplex_Calc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anurag1101%2FComplex_Calc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anurag1101","download_url":"https://codeload.github.com/Anurag1101/Complex_Calc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anurag1101%2FComplex_Calc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262685443,"owners_count":23348420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abstraction","complex-numbers","encapsulation","oops-in-python","python","python-script","python3"],"created_at":"2024-11-15T09:12:59.302Z","updated_at":"2025-06-29T23:38:23.157Z","avatar_url":"https://github.com/Anurag1101.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Complex Calculator\n\nThis repository contains a Python implementation of a `Complex` number calculator that supports various arithmetic operations, including `addition`, `subtraction`, `multiplication`, and `division` of `Complex` numbers. The implementation makes use of **Object-Oriented Programming Principles** and demonstrates the use of `dunder` (double underscore(__)) methods to overload operators for `Complex` number manipulation.\n\n## Features:\n\n- **Addition:** Add two complex numbers.\n\n- **Subtraction:** Subtract one complex number from another.\n\n- **Multiplication:** Multiply two complex numbers.\n\n- **Division:** Divide one complex number by another with error handling for division by zero.\n\n- **User Input:** The program allows users to input real and imaginary parts for complex numbers.\n\n## Implementation Details:\n\n### Class Complex: \n\nThe core class of this implementation is the Complex class, which encapsulates the properties and methods associated with complex numbers.\n\n### Attributes:\n\n- **r:** Real part of the complex number.\n\n- **i:** Imaginary part of the complex number.\n\n## Methods:\n\n- __init__(self, r, i): Constructor that initializes the real and imaginary parts.\n\n- __add__(self, C2): Overloads the + operator to add two complex numbers.\n\n- __sub__(self, C2): Overloads the - operator to subtract one complex number from another.\n\n- __mul__(self, C2): Overloads the * operator to multiply two complex numbers.\n\n- __truediv__(self, C2): Overloads the / operator to divide one complex number by another, with error handling for division by zero.\n\n- __str__(self): Provides a string representation of the Complex Number in the form of \"a + bi\".\n\n\n## Example usage\n\nThe following code demonstrates how to use the Complex class to perform arithmetic operations on complex numbers:\n\n    r1 = int(input(\"Enter the real part of first number: \"))  # Input real part of 1st number\n    i1 = int(input(\"Enter the imaginary part of first number: \"))  # Input imaginary part of 1st number\n    r2 = int(input(\"Enter the real part of second number: \"))  # Input real part of 2nd number\n    i2 = int(input(\"Enter the imaginary part of second number: \"))  # Input imaginary part of 2nd number\n    num1 = Complex(r1, i1)\n    num2 = Complex(r2, i2)\n    print(num1 + num2)   # Expected output: Sum of the two complex numbers\n    print(num1 - num2)   # Expected output: Difference of the two complex numbers\n    print(num1 * num2)   # Expected output: Product of the two complex numbers\n    print(num1 / num2)   # Expected output: Quotient of the two complex numbers\n\n## Error Handling:\n\nThe division method raises a `ValueError` if the **denominator is zero**, ensuring that the program does not attempt to divide by zero, which would result in an undefined operation.\n\n## Requirements: \n\n### Python 3.x\n\n## Installation:\n\n### Clone this repository:  \n\n    git clone https://github.com/USERNAME/complex_calc.git\n\n\n## Contribution:\n\nContributions are welcome! Please open an issue or submit a pull request if you have suggestions for improvements or new features.\n\n## License:\n\nThis project is licensed under the `MIT` License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanurag1101%2Fcomplex_calc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanurag1101%2Fcomplex_calc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanurag1101%2Fcomplex_calc/lists"}