PRACTICA 35: EJEMPLO DE AMBROCIO (MENU DE OPCIONES)



import math

def calculo():
    opc=0
    print 'MENU DE OPCIONES'
    print 'SELECCION LA OPCION'
    print '1. DETERMINAR SI EL NUMERO ES PAR'
    print '2. SACAR SENO Y COSENO DE 2 NUMEROS'
    print '3. SACAR LOGARITMO DE UN NUMERO'
    print '4. SALIR'
    opc= int (input('OPCION: '))

    if opc== 1:
        print 'INGRESE VALOR: '
        valor = int(input())
        residuo = valor %2
        if residuo ==0:
            print 'EL NUMERO ES PAR'
        else:
            print 'EL NUMERO ES IMPAR'


    elif opc == 2:
        valor1= int(input('\n DAME EL PRIMER VALOR: '))
        valor2= int(input('\n DAME EL SEGUNDO VALOR: '))
        sen1= math.sin(valor1)
        sen2= math.sin(valor2)
        cos1= math.cos(valor1)
        cos2= math.cos(valor2)
        print '\nSENO DEL VALOR 1: ', sen1
        print '\nSENO DEL VALOR 2: ', sen2
        print '\nCOS DEL VALOR 1: ', cos1
        print '\nCOS DEL VALOR 2: ', cos2

    elif opc == 3:
        valor1 =int(input('INGRESE UN VALOR PARA EL LOGARITMO: '))
        log = math.log10(valor1)
        print '\nLOGARITMO DEL VALOR 1: ', log

calculo()

No hay comentarios:

Publicar un comentario