Skip to content

Create cc.py #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Create cc.py #111

wants to merge 9 commits into from

Conversation

PavelLinearB
Copy link
Owner

@PavelLinearB PavelLinearB commented Apr 24, 2025

✨ PR Description

Purpose: This PR introduces a basic calculator program with a menu-driven interface for performing arithmetic operations.

Main changes:

  • Implements a calculator function for addition, subtraction, and multiplication
  • Creates a menu function for user interaction and program flow control
  • Utilizes operator functions (add, sub, mul) for calculations

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We’d love your feedback! 🚀

Copy link
Contributor

gitstream-cm bot commented Apr 24, 2025

Please mark which AI tools you used for this PR by checking the appropriate boxes:

  • GitHub Copilot
  • Cursor
  • Tabnine
  • JetBrains AI Assistant
  • VSCode IntelliCode
  • ChatGPT
  • Claude
  • Gemini
  • Other AI tool
  • No AI tools were used

Tip: If you want to avoid this comment in the future, add a label of the format "🤖 ai-*" when creating your PR, or ask your admin to add you to the pre-defined lists of known users

Copy link
Contributor

gitstream-cm bot commented Apr 27, 2025

Changelog: Request failed with status 500: Internal Server Error

@PavelLinearB PavelLinearB requested a review from Copilot April 29, 2025 12:40
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a basic calculator program with a menu-driven interface to perform arithmetic operations.

  • Implements a calculator function performing addition, subtraction, and multiplication
  • Creates a simple menu to drive user interaction and program flow control


def calc():
op = input("Enter operator +-*: ")
n1 = int(input('Fist number: '))
Copy link
Preview

Copilot AI Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo detected: 'Fist number:' should be corrected to 'First number:'.

Suggested change
n1 = int(input('Fist number: '))
n1 = int(input('First number: '))

Copilot uses AI. Check for mistakes.

Comment on lines +7 to +9
operators = {'+': add(n1, n2), '-': sub(n1, n2), '*': mul(n1, n2)}
if op in operators:
print('{} {} {} = {}'.format(n1, op, n2, operators[op]))
Copy link
Preview

Copilot AI Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The dictionary currently precomputes all operations regardless of the selected operator. Consider mapping operator symbols to the corresponding function (e.g., {'+': add, ...}) and then computing the result after determining the operator to improve efficiency and consistency.

Suggested change
operators = {'+': add(n1, n2), '-': sub(n1, n2), '*': mul(n1, n2)}
if op in operators:
print('{} {} {} = {}'.format(n1, op, n2, operators[op]))
operators = {'+': add, '-': sub, '*': mul}
if op in operators:
result = operators[op](n1, n2)
print('{} {} {} = {}'.format(n1, op, n2, result))

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant