Last active
August 14, 2020 02:26
-
-
Save rondinelisaad/b48a0c2cffdb7cc696c8fae8466c9721 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
numero1 = int(input("Informe um numero: ")) | |
numero2 = int(input("Informe um numero: ")) | |
try: | |
operador = input("Digite o operador: ") | |
if operador == "+": | |
soma = numero1 + numero2 | |
print ("{0} + {1} = {2}".format(numero1, numero2, soma)) | |
elif operador == "-": | |
subtracao = numero1 - numero2 | |
print ("{0} - {1} = {2}".format(numero1, numero2, subtracao)) | |
elif operador == "*": | |
multiplicacao = numero1 * numero2 | |
print ("{0} * {1} = {2}".format(numero1, numero2, multiplicacao)) | |
if operador == "/": | |
divisao = numero1 / numero2 | |
print ("{0} / {1} = {2}".format(numero1, numero2, divisao)) | |
except ValueError: | |
print("Operadores aceitáveis: +, -, *, /") | |
except ValueError: | |
print("Somente numeros sao aceitos. Tente novamente.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment