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
23- Suma de dos valores
Código:
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)
24- Factorial y Ceil(x)
Código:
import math a = 5 print math.factorial(a) print math.ceil(a
25- Condicional If
Código:
import time
print "Ingrese su nombre: "
nombre = raw_input()
if nombre == "Manuel":
print("Es usted administrador")
else:
print
26-Condicional If 2
Código:
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"
27- Numero par o impar
Código:
h = input("Introduzca un numero: ")
if h % 2 == 0:
print "Este numero es par"
else:
print "Este numero es impar"
28- Conversión decimal a binario
Código:
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)
29- Edad
Código:
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"
Comentarios
Publicar un comentario