Fantasy game inventory — Ch. 5 Automate the Boring Stuff
I am suggesting to use fstrings and the dictionary items() method.

The

print(f'{value} {key}')


instead of

print(str(inventory[item]) + ' ' + item)


is more neatly:

def display_inventory(inventory):
    total_items = 0 
    print ("Inventory:")

    for key, value in inventory.items():
        print(f'{value} {key}')
        total_items += value

    print(f'Total number of items: {total_items}')


Also, you can just calculate the total number in the needed place by the sum() function and the dictionary values() method. Then, you are not needing the total_items variable.

def display_inventory(inventory):
    print ("Inventory:")

    for key, value in inventory.items():
        print(f'{value} {key}')

    print(f'Total number of items: {sum(inventory.values())}')