Exemplo n.º 1
0
def opcoes(opcao, x, y):
    if opcao == 1:
        calculadora.soma(x, y)
    elif opcao == 2:
        calculadora.subtracao(x, y)
    elif opcao == 3:
        calculadora.multiplicacao(x, y)
    elif opcao == 4:
        calculadora.divisao(x, y)
    else:
        print("Opcao errada, selecione novamente")
        pegaNumeros()
def test_subtracao():
    assert subtracao(4, 9) == -5
    assert subtracao(12, 4) == 8
    assert subtracao(9, 6) == 3
    assert subtracao(4, -6) == 10
    assert subtracao(6, -4) == 10
    assert subtracao((4 / 2), (2 / 2)) == 2 / 2
Exemplo n.º 3
0
import calculadora

while True:
    print("1. Soma")
    print("2. Subtração")
    print("3. Multiplicação")
    print("4. Divisão")
    op = int(input("Que operação deseja realizar: "))
    x = float(input("Primeiro numero: "))
    y = float(input("Segundo  numero: "))

    if op == 1:
        print("Soma:", calculadora.soma(x, y))
    elif op == 2:
        print("Subtração:", calculadora.subtracao(x, y))
    elif op == 3:
        print("Multiplicação:", calculadora.multiplicacao(x, y))
    elif op == 4:
        print("Divisão:", calculadora.divisao(x, y))
    else:
        print("Opção inválida,tente novamente")
Exemplo n.º 4
0
 def test_subtracao(self):
     resultadoSubtracao = calculadora.subtracao(10, 5)
     self.assertEqual(resultadoSubtracao, 5)
Exemplo n.º 5
0
def test_subtracao():
    assert 1 == subtracao(3, 2)
Exemplo n.º 6
0
def entao_o_valor_retornado_da_subtracao_deve_ser(context, resultado):
    x = context.x
    y = context.y
    assert resultado == subtracao(x, y)
Exemplo n.º 7
0
def teste_sub():
    assert subtracao(6, 5) == 1