Generation

generate functionThu, 27 Apr 2023

# Realizar un programa que lea números de inscripción apellidos nombres de alumnos y que informe Apellido de los dos alumnos con número de inscripción más chico Nombre de los dos alumnos con número de inscripción más grande y Porcentaje de alumnos con numero de inscripción par

``````def get_student_data(names, surnames, numbers, min_number, max_number):

#Find the smallest number
for i, number in enumerate(numbers):
if number < min_number[1]:
min_number[1] = number
min_number[0] = i

#Find the biggest number
for i, number in enumerate(numbers):
if number > max_number[1]:
max_number[1] = number
max_number[0] = i

#Find the par numbers
par_numbers = 0
for number in numbers:
if number % 2 == 0:
par_numbers += 1

#Print the data
print('The student with the lowest number is: ' + names[min_number[0]] + ', ' + surnames[min_number[0]] + ' and the number is: ' + str(min_number[1]))
print('The student with the highest number is: ' + names[max_number[0``````