Загрузить файлы в «/»

This commit is contained in:
LyalinaA 2025-11-24 08:03:35 +00:00
commit d288c528d3

23
calculator.py Normal file
View File

@ -0,0 +1,23 @@
def calculator():
print("Выберите операцию:")
print("1. Сложение")
print("2. Умножение")
choice = input("Введите номер операции (1/2): ")
if choice in ['1', '2']:
num1 = float(input("Введите первое число: "))
num2 = float(input("Введите второе число: "))
if choice == '1':
result = num1 + num2
operation = "Сложение"
else:
result = num1 * num2
operation = "Умножение"
print(f"Результат {operation}: {result}")
else:
print("Некорректный ввод.")
calculator()