Загрузить в "calk"
2 работа
This commit is contained in:
parent
d0c8a9d575
commit
e96a104abc
@ -1,25 +1,14 @@
|
|||||||
while True:
|
num1 = float(input("введите первое число"))
|
||||||
print("\n1 - сложение")
|
num2 = float(input("введите второе число"))
|
||||||
print("2 - умножение")
|
operator = input("введите знак")
|
||||||
print("0 - выход")
|
if operator == "+":
|
||||||
|
result= num1 + num2
|
||||||
choice = input("Ваш выбор: ")
|
elif operator == "-":
|
||||||
|
result = num1-num2
|
||||||
if choice == "0":
|
elif operator == "/":
|
||||||
print("Выход.")
|
result = num1 / num2
|
||||||
break
|
elif operator == "*":
|
||||||
|
result = num1 * num2
|
||||||
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:
|
else:
|
||||||
print("Нет такого действия.")
|
print("ошибка ввода")
|
||||||
|
print(result)
|
||||||
Loading…
Reference in New Issue
Block a user