Programas de practica Python
Logaritmo de 2 numeros
from
time
import
*
from
math
import
*
print
"Ingresa un valor"
x
=
int
(
input
(""))
print
"ingrese otro valor"
y
=
int
(
input
(""))
s
=
log(x
+
y)
print
"el resultado es:"
, s
Suma de 2 números
from
time
import
*
from
math
import
*
print
"Ingresa un valor"
x
=
int
(
input
(""))
print
"ingrese otro valor"
y
=
int
(
input
(""))
s
=
(x
+
y)
print
"el resultado de la suma es:"
, s
Convertidor de numeros
import
time
print
"Programa de conversion de decimal a binario"
print
"Ingrese el numero a convertir"
time.sleep(
2
)
a
=
input
()
b
=
bin
(a)
print
b
time.sleep(
3
)
Numero par e impar
import
time
h
=
input
(
"Introduzca un numero:"
)
if
h
%
2
=
=
0
:
print
"Es numero par"
else
:
print
"Es numero impar"
Identificador de usuario
import
time
print
"Ingrese su nombre"
nombre
=
raw_input
()
print
"Cargando password"
time.sleep(
1
)
print
"*"
time.sleep(
2
)
print
"**"
time.sleep(
3
)
print
"***"
time.sleep(
4
)
print
"****"
time.sleep(
5
)
print
"*****"
print
"Carga 100% completa"
if
nombre
=
=
"yoly"
:
print
"Usted es el usuario"
else
:
print
"No es el usuario"
Clasificación de edad
edad
=
70
if
edad>
0
and
edad<
18
:
print
"Eres un nino"
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