Suma
This file contains hidden or 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
| #Programa Suma basica | |
| import time | |
| print"Ingresa el primer valor: " | |
| a=int(input("")) | |
| print"Ingresa el segundo valor: " | |
| b=int(input("")) | |
| suma=a+b | |
| print "Suma de Valores ingresados: " | |
| time.sleep(5) | |
| print(suma) |
Múltiplos
This file contains hidden or 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 | |
| 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 ") | |
| xmayor(num1,num2) |
Matemática
This file contains hidden or 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
| #Programa manejo de matematicas | |
| import time | |
| from math import* | |
| print"Ingresa el primer valor: " | |
| x=int(input("")) | |
| print"Ingresa el segundo valor: " | |
| y=int(input("")) | |
| suma=(x+y) | |
| s = log(x+y) | |
| print "El resultado el logaritmo natural de ",suma,": " | |
| time.sleep(5) | |
| print(s) |
if6
This file contains hidden or 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): | |
| cambio = monto – precioProducto | |
| return cambio | |
| monto= input("ingresa el monto: ") | |
| if monto < 5: | |
| iniciar(monto) | |
| else: | |
| print 'Monto debe ser menor a 5' |
if5
This file contains hidden or 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 :v" | |
| elif nota >= 4 and nota <= 6: | |
| return "Suficiente" | |
| elif nota >= 7 and nota <=10: | |
| return "Bien" | |
| nota= input('ingrese la nota: ') | |
| print notas(nota) |
if4
This file contains hidden or 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 | |
| def Numero (num): | |
| if num > 0: | |
| return "Es positivo" | |
| elif num < 0: | |
| return "Es negativo" | |
| elif num==0: | |
| return "Es un cero" | |
| num=input("Dame el numero ") | |
| print (Numero(num)) |
if3
This file contains hidden or 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 el valor: ' | |
| a= int (input("")) | |
| if a>0: | |
| print 'Es un numero positivo' | |
| elif a==0: | |
| print 'Es igual a cero' | |
| else: | |
| print 'Es un numero negativo' |
If2
This file contains hidden or 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 | |
| print 'Dame el valor: ' | |
| 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 deseado' |
Ventana con Tkinter
This file contains hidden or 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
| from Tkinter import* | |
| # Mi marco | |
| raiz=Tk() | |
| raiz.title("Mi aplicasion") | |
| # Mi etiqueta nombre | |
| nombreLabel1=Label(raiz,text="Nombre del alumno:") | |
| nombreLabel1.grid(row=0,column=0) | |
| # el entry del nombre | |
| cuadronombre = Entry(raiz) | |
| cuadronombre.grid(row=0,column=1) | |
| # Mi etiqueta Apellido | |
| ApellidoLabel1=Label(raiz,text="Apellido del alumno:") | |
| ApellidoLabel1.grid(row=1,column=0) | |
| # el entry del Apellido | |
| Apellidonombre = Entry(raiz) | |
| Apellidonombre.grid(row=1,column=1) | |
| raiz.mainloop() | |
Edad
This file contains hidden or 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 | |
| edad=18 | |
| print "Dame la Edad:" | |
| edad = int(input("")) | |
| if edad >= 0 and edad <18: # Todo metodo con ":" | |
| 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' |
Banco
This file contains hidden or 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 el prestamo 😑' | |
| else: | |
| print 'No es mayor de edad' | |
| edad() |