Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Python Problem with code

Tiasforma

New Coder
Hello, I have a problem with this code, it says 'Alumno' object is not iterable, ¿what do i need to do to fix this problem?, thanks in advance.
Python:
def Igual_Promedio(a, b):
    return sum(a) / 3 == sum(b) / 3
class Alumno:
    def __init__(self, data):
        self.data = i



# Declaracion de datos
data = []
data.append(["J Araneda", 1.0, 3.0, 7.0])
data.append(["K Bahamondes", 4.0, 4.0, 4.0])
data.append(["J Carrasco", 3.0, 3.0, 3.0])
data.append(["H Diaz", 3.0, 4.0, 5.0])
data.append(["I Elgueta", 6.0, 4.0, 3.5])
data.append(["J Faundez", 5.0, 4.5, 6.5])
data.append(["G Gutierrez", 4.0, 5.0, 5.5])
data.append(["F Hernandez", 5.0, 4.6, 4.5])
data.append(["H Isla", 6.0, 6.0, 6.0])
data.append(["A Jodorowsky", 7.0, 4.7, 6.1])

############################
A = []
for i in data:
    tmp = Alumno(i)
    A.append(tmp)

print(Igual_Promedio(A[0], A[8]))

PS: I cant modify anything below "#Declaracion de datos" since in the problem i'm supposed to just make a class with objects(like A1=Alumno(data[1]), A2=Alumno(data[2], and so on) and methods to do certain mathematical operations with the data.
 
Last edited:

New Threads

Buy us a coffee!

Back
Top Bottom