Skip to content

HW2_Islamova#3

Open
rentagr wants to merge 30 commits intoPython-BI-2025-26:mainfrom
rentagr:HW2_Islamova
Open

HW2_Islamova#3
rentagr wants to merge 30 commits intoPython-BI-2025-26:mainfrom
rentagr:HW2_Islamova

Conversation

@rentagr
Copy link

@rentagr rentagr commented Sep 15, 2025

No description provided.

rentagr and others added 30 commits September 15, 2025 15:20
insert add func, refactor main logic
Fix errors and change image path
@rentagr rentagr changed the title Add management functions (main) HW2_Islamova Sep 21, 2025
@rentagr
Copy link
Author

rentagr commented Sep 21, 2025

Calculator Fixes

  • Fixed syntax errors in main function
  • Added proper input validation
  • Handled division by zero case
  • Improved error messages
  • Added empty input check

README Updates

  • Added installation instructions
  • Added usage examples

# Testing

  • Tested with valid inputs: 5 + 38.0
  • Tested with decimals: 12.5 * 225.0
  • Tested division by zero: 5 / 0 → proper error message
  • Tested invalid operators: 5 % 3 → error message

Copy link

@eksytnik eksytnik left a comment

Choose a reason for hiding this comment

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

Отличная работа! Есть пара замечаний в коде, а также вопросы к названиям коммитов: их стоит начинать с большой буквы, и не указывать в прошедшем времени, т.е. не added, а Add

Зато супер сделаны дополнительные проверки и комментарии, всё по уму по делу и про разные крайние случаи подумали, и про удобство пользователя.
+1 доп балл за них.

Баллы: 10/10 (README) + 10/10 (ветки) + 78/80 (код и коммиты) + 11 доп. =
= 98/100 + 11 доп.

(тимлид, не забудь показать ревью всей команде)


AVAILABLE_OPERATORS = ['+', '-', '*', '/']

def add(a, b):

Choose a reason for hiding this comment

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

Лучше, конечно, избегать названий в один символ, если это не счетчики.
num1, num2 оптимальнее.

Comment on lines +6 to +8
result = a + b
return result

Choose a reason for hiding this comment

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

Можно было бы и

Suggested change
result = a + b
return result
return a + b

Не обязательно и не всегда нужно, особенно если вычисление длинное - но тут оно короткое и очевидное. Помогает читаемости кода.

Comment on lines +18 to +20
if b == 0:
print("Error: Division by zero is not possible")
return None

Choose a reason for hiding this comment

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

Классно, что об этом подумали, и еще более здорово, какую выбрали реализацию. Но вообще говоря, тут будет ошибка деления на ноль - и ладно. Но об ошибках и работе с ними еще будет. Клево, что возвращаете именно None, очень правильное направление мысли.

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.

6 participants