INTRODUCCION A LA PROGRAMACION - Clase 3


EJERCICIOS

1. SPYDER PHTYTON: CALCULAR PROMEDIOS

# -*- coding: utf-8 -*-
print ("promedio de 3 notas")
pn = float(input("Dame tu primera mala nota"))
sn = float(input("Dame tu segunda mala nota"))
tn = float(input("Dame tu tercera mala nota"))
prom = (pn+sn+tn)/3
print ("el promedio de las notas es = ",prom)


2 CALCULAR SI EL VALOR ES PAR O IMPAR
print ("Hola, Hola")
num = int(input("Ingrese un numero entero"))
if (num%2)== 0:
   print ("el numero ingresado es par")
else:
   print ("El numero ingresado es impar")
   print ("¡Listo!, acabamos")




3. mostrar el promedio de 3 notas, pero si  alguna nota es mayor a 5, el programa valida que las notas no deben ser superiores a 5

print ("promedio de 3 notas")
pn = float(input("Dame tu primera mala nota"))
sn = float(input("Dame tu segunda mala nota"))
tn = float(input("Dame tu tercera mala nota"))
prom = (pn+sn+tn)/3
print ("el promedio de las notas es = ",prom)


if (prom) < 5:
   print ("es el promedio de este semestre")
else:
   print ("El promedio no debe superior a 5, error")
   print ("ingrese valores inferiores a 5")

4. detectar los # mayores a 100 y menores a 10

menores = 0
mayores = 0

print ("ingrese 5 digitos.")

d1 = float(input("Digite el primer numero"))
d2 = float(input("Digite el segundo numero"))
d3 = float(input("Digite el tercer numero"))
d4 = float(input("Digite el cuarto numero"))
d5 = float(input("Digite el quinto numero"))

if d1 > 100:
   mayores = mayores + 1
if d1 < 10:
   menores = menores + 1
if d2 > 100:
   mayores = mayores + 1
if d2 < 10:
   menores = menores + 1
if d3 > 100:
   mayores = mayores + 1
if d3 < 10:
   menores = menores + 1
if d4 > 100:
   mayores = mayores + 1
if d4 < 10:
   menores = menores + 1
if d5 > 100:
   mayores = mayores + 1
if d5 < 10:
   menores = menores + 1

if mayores == 0:
      if menores == 0:
          print ("No hay numeros en ese rango")
if mayores > 0:
     print ("Numeros mayores a 100 hay:", mayores)
   
if menores > 0:
     print ("Numeros menores a 10 hay:", menores)
   




Share this

Related Posts

Previous
Next Post »