# 9. "Integers, not strings"

#1

Hi everyone,

I just can't see where the problem is.. Has anybody an idea please ?

#2

Hello, @bitcoder89423 !
I can't really see what's the matter at lines 27 and 54 because at line 54 you're passing a list and at line 27 you're accessing the "homework" key in the dictionary.
But there's a problem at line 49 where you're passing an entire list to

``calcule_moyenne``

but not the

``each``

which is the variable that will iterate through you list and get each element, which is a list entry which will lead you to a dictionary, so you can use on your function.

If it's still wrong, quote me and I'll see what I can do!

Best regards,
g4be

#3

Hello, g4be, and thanks for trying to help me !

I'm affraid I've not well understood you : I modified line 49 and that's what it gave :

Ooops ! and "Help !"

#4

Well, guess instead of calling another function, you're calling the same function you're in right now and that's called recursion which is a function calling itself, like a factorial (which is the most common example):

``````def factorial(number):
if number == 0:
return 1
return factorial * factorial(number-1)``````

In that case you should've called the function get_average() for each student.

``````def get_class_average(students):
#Code here
for studentsName in students:
results.append(get_average(studentsName))
#Code here``````

Hope I was clear, if not let me know and I'll explain it in a different way.

Also, here's some info about the recursion in Python: Recursion - Python

Best regards,
G4be.

#5

OK, g4be, I've read the course about recursion, and discover this Python course, thanks for it !

But what I do not understand is the reason why there is a recursion. I mean everything was OK at the step before and I suddenly discover a recursion initiated when that was abolutely not the aim of the exercise.
We only wanted to see the results with 2 lines of "print".

How to stop the recursion (or avoid to initiate it) and simply print ?

Best regards

#6

You're doing this:

``````def calculate_class_moyenne(etudiants):
#Code here!
#Code here !
resultats.append(calcule_classe_moyenne(etudiants)) #This is recursion!``````

To stop a recursion, simply remove the call of it.
In that part of your code I believe you're supposed to get the average of each student so I'd suggest you to change that!

Give it a try, if it doesn't work, let me know!

#7

I need to help me. My problem is when i put my code, this put me "Your code does not run until the end. The error message is in the output window."

Necesito ayuda. El problema que tengo es que me marca el siguiente error "Tu código no se ejecutó hasta el final. El mensaje de error está en la ventana de resultados."

my code is:

#8

julio encontraste la solución del problema?.. Tengo el mismo problema que tu .. me da error no encuentro la solución!

#9

Mi error fue que no declare bien mi lista, pero me lo había marcado bien en el ejemplo anterior, el cambio esta en la linea 23

alumnos = [candela,milagros,ramiro]

al final poner lo siguiente :
print obtener_promedio_clase(alumnos)
print calificaciones_con_letras(obtener_promedio_clase(alumnos))