PROGRAMAS UNIDAD 1
1.- Suma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from math import* | |
print"Ingresa un primer valor: " | |
x=int(input("")) | |
print "Ingresa un segundo valor: " | |
y=int(input("")) | |
s=(x+y) | |
print "El resultado es:",s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from math import* | |
print"Ingresa un primer valor: " | |
x=int(input("")) | |
print "Ingresa un segundo valor: " | |
y=int(input("")) | |
s=log(x+y) | |
print "El resultado es:",s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding: utf-8 | |
from math import* | |
print("Ingresa tu edad") | |
edad= input () | |
edad= int(edad) | |
if edad >=1 and edad <18: | |
print "Eres un niño" | |
elif edad <=0: | |
print "No numeros negativos" | |
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print"Ingrese un numero" | |
a=int(input("")) | |
if a == 5: | |
print "Es un cinco" | |
elif a == 6: | |
print "Es un seis" | |
elif a == 7: | |
print "Es un siete" | |
else: | |
print "No es ningun numero" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print"Dame un valor" | |
a= int(input("")) | |
if a > 0: | |
print "Es un numero positivo" | |
elif a==0: | |
print "Es igual a cero" | |
else: | |
print"Es negativo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def Numero(num): | |
if num > 0: | |
return "Es positivo" | |
elif num < 0: | |
return "Negativo" | |
num=input("Dame el numero:") | |
print(Numero(num)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def xmayor(num1,num2): | |
if num2 % num1==0: | |
print num1, "es multiplo de ",num2 | |
else: | |
print num1, "No es multiplo de ",num2 | |
num1=input("Dame el primer numero:") | |
num2=input("Dame el segundo numero:") | |
print xmayor(num1,num2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def notas(nota): | |
if nota>=0 and nota <=3: | |
return "Insuficiente" | |
elif nota >= 4 and nota <= 6: | |
return "Suficiente" | |
elif nota >=7 and nota <= 10: | |
return "Bien" | |
nota=input("Ingrese la nota: ") | |
print notas(nota) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def iniciar(monto): | |
dulce=raw_input("Elija la letra") | |
if dulce =="a": | |
precioProducto=2.5 | |
print "Su cambio es: ", calcularcambio(precioProducto,monto) | |
elif dulce == "b": | |
precioProducto = 1.4 | |
print "Su cambio es: ", calcularcambio(precioProducto,monto) | |
elif dulce == "c": | |
precioProducto = 1.2 | |
print "Su cambio es: ", calcularcambio(precioProducto,monto) | |
def calcularcambio(precioProducto,monto): | |
return monto-precioProducto | |
monto=input("Ingrese el monto: ") | |
if monto <5: | |
print iniciar(monto) | |
else: | |
print "Monto debe ser menor a 5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _cuotas(prestamo, meses): | |
cuotas= prestamo/meses | |
return cuotas | |
def _Prestamo(ingresos,egresos): | |
prestamo=input("Monto del prestamo: ") | |
meses=input("Cuantos meses de pago: ") | |
print "Monto de pago por mes: ",_cuotas(prestamo,meses) | |
def edad(): | |
edad= input("Ingrese su edad:") | |
if edad >= 18: | |
ingresos= input("Dame tus ingresos: ") | |
egresos= input("Dame tus egresos:") | |
if ingresos >= egresos: | |
_Prestamo(ingresos,egresos) | |
else: | |
print ("No es posible hacer prestamo") | |
else: | |
print "No es mayor de edad" | |
edad() |
Comentarios
Publicar un comentario