chandeg minus func
This commit is contained in:
parent
b78efac316
commit
895695f5a8
9
calc.py
9
calc.py
@ -1,7 +1,7 @@
|
|||||||
def main():
|
def main():
|
||||||
print("Welcome to the Calculator")
|
print("Welcome to the Calculator")
|
||||||
command = input("Select command: [ + ] [ - ] [ * ] [ / ] \nType exit if u want exit \n")
|
command = input("Select command: [ + ] [ - ] [ * ] [ / ] \nType exit if u want exit \n")
|
||||||
match command:
|
match command: #выбор команд
|
||||||
case "+":
|
case "+":
|
||||||
summ()
|
summ()
|
||||||
case "*":
|
case "*":
|
||||||
@ -18,7 +18,7 @@ def summ():
|
|||||||
total = 0
|
total = 0
|
||||||
while True:
|
while True:
|
||||||
num_input = input()
|
num_input = input()
|
||||||
if num_input == " ":
|
if num_input == " " or num_input == "":
|
||||||
print (f"Total summ = {total}")
|
print (f"Total summ = {total}")
|
||||||
main()
|
main()
|
||||||
try:
|
try:
|
||||||
@ -43,7 +43,7 @@ def minus():
|
|||||||
print("Error, enter correct number")
|
print("Error, enter correct number")
|
||||||
def multiplication():
|
def multiplication():
|
||||||
print("Enter number to multiplication, enter space to calculate")
|
print("Enter number to multiplication, enter space to calculate")
|
||||||
total = 0
|
total = 1
|
||||||
while True:
|
while True:
|
||||||
num_input = input()
|
num_input = input()
|
||||||
if num_input == " ":
|
if num_input == " ":
|
||||||
@ -55,5 +55,6 @@ def multiplication():
|
|||||||
print(f"Total multiplication = {total}")
|
print(f"Total multiplication = {total}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Error, enter correct number")
|
print("Error, enter correct number")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main() #запуск функции main, основа программы
|
||||||
Loading…
Reference in New Issue
Block a user