Python Projects - Budget App

Hi, first of all thank you to whoever helps me!
So I am having trouble with the last function in the program. This is why I have so far, so I basically don’t really know how I would print the other items next to each other with the spaces, if somebody could explain me how to do it it would be much appreciated. :slight_smile:

def create_spend_chart(list_categories):
title = ‘Percentage spent by category’
for i in range(100, -10, -10):
if i == 100:
print(str(i) + ‘|’)
if i < 100 and i > 0:
print(’ ’ + str(i) + ‘|’)
if i == 0:
print(’ ’ + str(i) + ‘|’)

x = len(list_categories) + 2
print('    ' + '-' * x)

x = '    '
counter = 0
for item in list_categories:
    for word in item:
        print('    ' + ' ' * counter + word)
    print(end='')
    counter += 1

This is what it looks like:

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.

Challenge: Budget App

Link to the challenge:

@noelaronc You can achive the effect you want using print with format.
You might have to put that outside of the loop.

Example:

my_text = 'Food savings ...'

for a in range(1, 10):
    print(a)
print('{}'.format(my_text))

Output:

1
2
3
4
5
6
7
8
9
Food savings ...
>>>