1 - Números entre
a = int(input("Número 1: "))
b = int(input("Número 2: "))
for i in range(min(a, b)+1, max(a, b)):
print(i)
2 - Bacterias
A, B, dias = 4, 10, 0
while A < B:
A *= 1.03
B *= 1.015
dias += 1
print("Días:", dias)
3 - Calificaciones válidas
for _ in range(15):
nota = -1
while nota < 0 or nota > 5:
nota = float(input("Calificación (0-5): "))
4 - Promedio temperaturas
suma, count = 0, 0
while True:
t = float(input("Temp °C: "))
if t == -273: break
suma += t
count += 1
print("Promedio:", suma/count if count > 0 else 0)
5 - Factorial
n = int(input("Número: "))
fact = 1
for i in range(1, n+1):
fact *= i
print("Factorial:", fact)
6 - Tabla multiplicar
n = int(input("Número: "))
print(f"Tabla del {n}:")
for i in range(1, 11):
print(f"{n} x {i} = {n*i}")
7 - Primo
n = int(input("Número: "))
es_primo = n > 1 and all(n % i != 0 for i in range(2, int(n**0.5)+1))
print("Primo" if es_primo else "No primo")
8 - Distribución edades
i1=i2=i3=i4=0
while True:
e = int(input("Edad: "))
if e < 0: break
if e <= 25: i1 += 1
elif e <= 50: i2 += 1
elif e <= 75: i3 += 1
else: i4 += 1
print(f"[0-25]:{i1}, [26-50]:{i2}, [51-75]:{i3}, [76-100]:{i4}")
9 - Votación
votos = [0,0,0,0,0,0] # 1-6
for _ in range(20):
v = int(input("Voto (1-6): "))
if 1 <= v <= 6:
votos[v-1] += 1
total = sum(votos)
for i in range(4):
print(f"Candidato {i+1}: {votos[i]}")
print(f"Nulos: {votos[4]} ({votos[4]/total100:.2f}%)")
print(f"Blanco: {votos[5]} ({votos[5]/total100:.2f}%)")