Está en la página 1de 4

#---------------EJERCICIO 1---------------

#----------------ES VOCAL----------------

def EsVocal():
letra = str(input("Ingrese una letra: "))
letra = letra.upper()
if letra == "A" or letra == "E" or letra == "I" or letra == "O" or letra == "U":
return True
else:
return False

a = EsVocal()
if a == True:
print("Es vocal")
else:
print("No es vocal")

#--------------ENTEROS----------------

def enteros():

a = int(input("Ingrese un n�mero: "))


b = int(input("Ingrese un n�mero: "))

if b > a:
mayor = b
menor = a
else:
mayor = a
menor = b

x = list(range(menor+1,mayor))
print(x)

enteros()

#------------NUMEROS PRIMOS------------------

def Primos():
for num in range(1,1000):
for var in range(2,num):
if num%var == 0: #Si el resto de la divisi�n es 0, cierra
break
else:
print(num)

c = Primos()

#----------M�XIMO COM�N DIVISOR---------------

def Val():
a = int(input("Ingrese valor 1: "))
b = int(input("Ingrese valor 2: "))
global mayor
global menor

if a < b:
mayor = b
menor = a
else:
mayor = a
menor = b

def MCD():
list1 = []
list2 = []

for x in range(2, menor):


c = menor/x

if c - round(c) == 0:
list1.append(c)

for y in range(2, mayor):


d = mayor/y

if d - round(d) == 0:
list2.append(d)

lista = set(list1) & set(list2)

print("Los divisores :",lista,"\nEl MCD es: ", max(lista))

Val()
MCD()

#----------------NOTAS----------------------

def Notas():
aprobados = 0
reprobados = 0
ampliacion = 0

for x in range(1,7):
nota = int(input("Ingrese nota: "))
if nota >= 66:
aprobados = aprobados + 1
elif nota < 60:
reprobados = reprobados + 1
elif nota >= 60 and nota <= 65:
ampliacion = ampliacion + 1

print("Aprobaron: ",aprobados,", reprobaron: ",reprobados,", ampliaci�n: ",


ampliacion)

j = Notas()

#---------------Factorial-------------------
def factorial():

a = int(input("Ingrese n�mero: "))


fact = 1

if a == 0 and a == 1:
print("Factorial = 1")
else:
for x in range(1,a+1):
fact = fact*x

print("El factorial de",a,"es:",fact)

factorial()

#---------------A�o bisiesto---------------

def Bisiesto():

a = int(input("Ingrese a�o:"))
b = a/4
c = a/100
d = a/400
if b - round(b) == 0 and c - round(c) == 0 and d - round(d) == 0:
print(a,"es un a�o bisiesto.")
Bisiesto()
elif b - round(b) == 0 and c - round(c) != 0:
print(a,"es un a�o bisiesto.")
Bisiesto()
else:
print(a,"no es un a�o bisiesto.")
Bisiesto()

Bisiesto()

#---------------MC DONALDS----------------
class Mc:
def __init__(self, salir,
opcion, dineroVenta, totalArroz):
self.salir = salir
self.opcion = opcion
self.dineroVenta = dineroVenta
self.totalArroz = totalArroz

def validaciones(self):
if(self.dineroVenta >= 100000):
print("Dinero limite alcanzado")
return True
else:
return False

def whileMenu(self):
while not self.salir:
print ("1. Pollo con papas y fresco")
print ("2. Hamburguesa con sundae")
print ("3. Pollo con hamburguesa")
print ("4. Arroz con pollo")
print ("5. Salir")
print ("Elige una opcion")

self.opcion = int(input("Introduce un numero entero: "))


if self.opcion == 1:
print ("Opcion 1")
self.dineroVenta += 100
print(self.dineroVenta)
self.salir = self.validaciones()

elif self.opcion == 2:
print ("Opcion 2")
self.dineroVenta += 200
print(self.dineroVenta)
self.salir = self.validaciones()

elif self.opcion == 3:
print("Opcion 3")
self.dineroVenta += 300
print(self.dineroVenta)
self.salir = self.validaciones()

elif self.opcion == 4:
print("Opcion 4")
self.dineroVenta += 400
self.salir = self.validaciones()
self.totalArroz -= 1
print(self.totalArroz)

"""si el total de arroz es menor o igual a 0 entonces se detiene el while


"""
if self.totalArroz <= 0:
print ("No quedan arroz")
self.salir = True

elif self.opcion == 5:
self.salir = True
else:
print ("Introduce un numero entre 1 y 4")

print ("Fin")

p1 = Mc(False,0,0,10)
p1.whileMenu()

También podría gustarte