geekcomputers/Python

Calculadora em Python

Closed this issue · 0 comments

Feitos Com Fins De Aprendizagem...

import time
import math

#Tela De Login

login = input("Seu Login:    ")
nome = input("Qual  Seu nome???     ")
time.sleep(0.9)
print("Login Salvo...")

while True:
    print ("""
\033[1;33mSUA CALCULADORA EM PYTHON\033[m
    """)
    print ("""
\033[1;34mESCOLHA OS OPERADORES QUE DESEJA EXECULTAR\033[m
    \033[1m
    [ 1 ]  MULTIPLICAÇÃO
    [ 2 ]  ADIÇÃO
    [ 3 ]  DIVISÃO
    [ 4 ]  SUBTRAÇÃO
    [ 5 ]  POTENCIAÇÃO
    [ 6 ]  RAIZ QUADRADA
    [ 7 ]  BASES NUMÉRICAS
    [ 8 ]  PORCENTAGEM
    \033[m""")
    
    op = int(input("Qual Operador Deseja Execultar:   "))
    
    if op == 1:
        print("Execultando MULTIPLICAÇÃO...")
        time.sleep(0.5)
        n1 = int(input("1° multiplicador:   "))
        n2 = int(input("2° multiplicador:   "))
        resultado = n1 * n2
        print("RESULTADO {}".format(resultado))
        break
        
    elif op == 2:
        print("Execultando ADIÇÃO...")
        time.sleep(0.5)
        n1 = int(input("1° numero:   "))
        n2 = int(input("2° numero:   "))
        soma = n1 + n2
        print("RESULTADO {}".format(soma))
        break
        
    elif op == 3:
        print("Execultando DIVISÃO...")
        time.sleep(0.5)
        n1 = int(input("1° Divisor:   "))
        n2 = int(input("2° Divisor:   "))
        divisão = n1 / n2
        print("RESULTADO {:.2f}".format(divisão))
        break
        
    elif op == 4:
        print("Execultando SUBTRAÇÃO...")
        time.sleep(0.5)
        n1 = int(input("1° numero:   "))
        n2 = int(input("2° numero:   "))
        subtração = n1 - n2
        print("RESULTADO {}".format(subtração))
        break
        
    elif op == 5:
        print("Execultando POTENCIAZÃO...")
        time.sleep(0.5)
        n1 = int(input("Numero:   "))
        n2 = int(input("Potencia:   "))
        pow = n1 **n2
        print("RESULTADO {}".format(pow))
        break
        
    elif op == 6:
        print("Execultando RAIZ...")
        time.sleep(0.5)
        num = int(input("Raiz De:    "))
        raiz = math.sqrt(num)
        print("RESULTADO {:.2f}".format(raiz))
        break
        
    elif op == 7:
        print("Execultando BASES...")
        time.sleep(0.5)
        
        print ("""\033[1m
        Escolha uma das bases para conversão:  
        [ 1 ] BINÁRIO
        [ 2 ] OCTAL
        [ 3 ] HEXADECIMAL
        \033[m""")
         
        esc = int(input("Qual Base Deseja Execultar:   "))
        if esc == 1:
             print("Execultando base BINÁRIA...")
             time.sleep(0.09)
             n1 = int(input("Digite o Numero:   "))
             print ("RESULTADO {} em BINARIO".format(bin(n1)[2:]))
             
        if esc == 2:
             print("Execultando base OCTAL...")
             time.sleep(0.09)
             n1 = int(input("Digite o Numero:   "))
             print("RESULTADO {} em OCTAL".format(bin(n1)[2:]))
             
        if esc == 3:
             print("Execultando base HEXADECIMAL...")
             time.sleep(0.09)
             n1 = int(input("Digite o Numero:   "))
             print("RESULTADO {} em HEXADECIMA".format(hex(n1)[2:]))
             break
             
    elif op == 8:
        print("Execultando Porcentagem...")
        time.sleep(0.5)
        print ("""\033[1;m
        [ 1 ] ADIÇÃO DE PORCENTAGEM
        [ 2 ] SUBTRAÇÃO DE PORCENTAGEM
        [ 3 ] SIMPLES
         \033[m""")
         
        esc = int(input("Qual Metodos Deseja Usar:   "))
         
        if esc == 1:
             print("Adição De Porcentagem..")
             time.sleep(0.09)
             n1 = int(input("%"))
             n2 = int(input("Numero:   "))
             resul = (n1 * n2) / 100
             soma = n2 + resul
             print("{} + {}% é {}".format(n2,n1,soma))
             
        elif esc == 2:
             print("Subtraindo Porcentagens...")
             time.sleep(0.09)
             n1 = int(input("%"))
             n2 = int(input("Numero:   "))
             resul = (n1 * n2) / 100
             soma = n2 - resul
             print("{} - {}% é {}".format(n2,n1,soma))
             
        elif esc == 3:
             print("Adicionando Porcentagens...") 
             time.sleep(0.09)
             n1 = int(input("%"))
             n2 = int(input("Numero:   "))
             resul = (n1 * n2) / 100
             print("{} + {}% é {}".format(n2,n1,resul))
             break
             
             
             
    else:
         time.sleep(2)
         print("OPÇÃO INVALIDA!!")
         print("TENTE NOVAMENTE...")
         time.sleep(3)


print("""

""")                  
print("OBRIGADO POR ULTILIZAR MEU PROGRAMA {}".format(nome))
print("@vzn.just Agradeçe :) ")