python
items = {'apple': 100, 'banana': 200, 'orange': 400}
money = 1000
for item_name in items:
    print('--------------------------------------------------')
    print('In the wallet' + str(money) + 'Contains a circle')
    
    print(item_name + 'Is one' + str(items[item_name]) + 'It's a yen')
    
    input_count = input('To buy' + item_name + 'Please enter the number of:')
    print('To buy' + item_name + 'The number of' + input_count + 'It is an individual')
    count = int(input_count)
    total_price = items[item_name] * count
    print('The payment amount is' + str(total_price) + 'It's a yen')
    
    if money >= total_price:            
        print(item_name + 'To' + input_count + 'I bought one')            
        money -= total_price            
    else:            
        print('Not enough money')            
        print(item_name + 'Could not buy')
Recommended Posts