Hello guys, it has been some days since my last post here.
I am currently working on the budget app project. I was very confused with the concept and syntax around classes in python so I decided to search for tutorials to check how the syntax works in this project specifically (before that I read the python official documentation). Having checked that, I stopped the video (because I wanna be able to solve it on my on) and now I am trying to set the way that the category class is going to be printed.
I am running into some issues with how to get the description and amount from the ledger and put them in a new variable: Here is how my code looks:
def __repr__(self): n = int((30 - len(self.name))/2) num_asterisks = '*' * n Headline = num_asterisks+self.name+num_asterisks+'\n' for i in self.ledger: description_index = i.index(description) transaction = i[description_index:]
I know I need a For loop to check each index of the self.ledger. But I don’t know how to access the description and the amount.
Thanks to all in advance