Continuing the discussion from Python Budget App – create_spend_chart function is killing me:
Hey, @Alchemixst. I am reaaally stuck too in the chart part, however, it’s not because I’m not passing but I couldn’t understand what to do then I came here and I saw your technique. Thankfully, I got an idea how to do it. I was about to code it but I am very hesitant for it looks very similar to yours (especially in the bar parts) except that I only used a single function (the spend_chart function). I fear that I might be sentenced of plagiarism for it. Can I get your opinion to my code if it looks more plagiarized rather than inspired?
def create_spend_chart(categories): total_spending = 0 percentage =  for category in categories: total_spending += category.withdrawal() for category in categories: output = round((category.withdrawal()/total_spending), 2) percentage.append(output * 100) to_print = "Percentage spent by category\n" i = 100 while i >= 0: for percentge in percentage: if percentge >= i: bar_space += "o " else: bar_space += " " to_print += str(i).rjust(3) + "|" + " " + "\n" i -= 10 bar = " " + ("---" * (len(categories))) + "-" + "\n" names =  for category in categories: names.append(str(category.name)) max_legt = max(categories, key=len) names_catg = " " for i in range(len(max_legt)): for name in names: try: names_catg += names[i] + " " except IndexError: pass names_catg += "\n" return to_print + bar + names_catg