Commit c38f4a83 by Patryk Czarnik

kalkulator z break

parent 46d340fb
while True:
op = input('Podaj znak operacji lub znak ! aby zakończyć: ')
if op == '!':
break
x = int(input('Podaj pierwszą liczbę: '))
y = int(input('Podaj drugą liczbę: '))
if op == '+':
wynik = x + y
elif op == '-':
wynik = x - y
elif op == '*':
wynik = x * y
elif op == '/':
if y == 0:
wynik = 'Nie wolno dzielić przez zero!'
else:
wynik = x / y
else:
wynik = 'Nieznana operacja'
print(wynik)
print('Dziękujemy za skorzystanie z usług kalkulatora.')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment