Загрузить файл в "calk"
This commit is contained in:
commit
d0c8a9d575
25
calculator.py
Normal file
25
calculator.py
Normal file
@ -0,0 +1,25 @@
|
||||
while True:
|
||||
print("\n1 - сложение")
|
||||
print("2 - умножение")
|
||||
print("0 - выход")
|
||||
|
||||
choice = input("Ваш выбор: ")
|
||||
|
||||
if choice == "0":
|
||||
print("Выход.")
|
||||
break
|
||||
|
||||
numbers = list(map(float, input("Введите числа через пробел: ").split()))
|
||||
|
||||
if choice == "1":
|
||||
print("Результат:", sum(numbers))
|
||||
|
||||
elif choice == "2":
|
||||
result = 1
|
||||
for n in numbers:
|
||||
result *= n
|
||||
print("Результат:", result)
|
||||
|
||||
else:
|
||||
print("Нет такого действия.")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user