[GO] [Python] Shopping program

Make a shopping program in Python

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')

that's all

Recommended Posts

[Python] Shopping program
Python
Newcomer training program by Python
Homebrew Python --Youtube Search Program
Debug python multiprocess program with VSCode
Prime number generation program by Python
Compatibility diagnosis program written in python
When writing a program in Python
kafka python
Python basics ⑤
python + lottery 6
Python Summary
Built-in python
[Python] A program that creates stairs with #
Python comprehension
Python technique
Homebrew Python Part 3-Amazon Product Search Program
Studying python
Python 2.7 Countdown
Python memorandum
Python FlowFishMaster
Python service
python tips
python function ①
Python basics
Python memo
ufo-> python (3)
Python comprehension
I made a payroll program in Python!
install python
Python Singleton
Python basics ④
Python Memorandum 2
python memo
Python Jinja2
Python increment
atCoder 173 Python
[Python] function
Python installation
2D FEM stress analysis program with Python
python tips
Installing Python 3.4.3.
Try python
Python memo
Python iterative
Python algorithm
Python2 + word2vec
[Python] Variables
Python functions
Python sys.intern ()
Python tutorial
Python decimals
python underscore
Python summary
Start python
[Python] Sort
HTML document your Python program with Sphinx
Note: Python
Write a Caesar cipher program in Python
Python basics ③
python log