lunes, 22 de octubre de 2018

Practicas en clase

       

MANEJO MATEMATICO

import time
from math import *
 
print "Ingresa un primer valor :"
x = int(input(""))
 
time.sleep(5)
 
print "Ingresa un segundo valor: "
y = int(input(""))
 
s = log(x + y)
print




SUMA DE DOS VALORES

import time
import time
 
print "Ingresa un primer valor: "
a = int(input(""))
 
time.sleep(5)
 
print "Ingresa un segundo valor: "
b = int(input(""))
 
suma = a + b
 
print "Suma de valores ingresados: "
print (suma)




FACTORIAL

import math
 
a = 5
 
print math.factorial(a)
 
print math.ceil(a




Condición "if"

import time
 
print "Ingrese su nombre: "
nombre = raw_input()
 
if nombre == "Manuel":
    print("Es usted administrador")
else:
    print("No tienes acceso")




Condición "if#2"

import time
 
print "Programa que usa if"
print "Ingrese su nombre: "
 
nombre = raw_input()
 
print "Cargando password"
 
time.sleep(1)
time.sleep(2)
print"**"
 
time.sleep(3)
print "***"
 
time.sleep(4)
print "****"
 
time.sleep(5)
print "*****"
print"Carga completa 100%"
 
if nombre == "Manuel":
    print "Usted es administrador"
 
else:
    print "No eres el usuario root"




NUMERO PAR E IMPAR
h = input("Introduzca un numero: ")
 
if h % 2 == 0:
    print "Este numero es par"
 
else:
    print "Este numero es impar"





DECIMAL A BINARIO

import time
 
print "Programa de conversion a binario"
print "Ingrese el numero a convertir"
 
time.sleep(2)
 
a = input()
b = bin(a)
 
print (b)
 
time.sleep(3)



EDAD

edad = 30
if edad>=0 and edad <18:
    print "Eres un niño"
elif edad>=18 and edad<27:
    print "Eres un joven"
elif edad>= 27 and edad <60:
    print "Eres un adulto"
else:
    print "Eres de la tercera edad"
 

No hay comentarios.:

Publicar un comentario