I'll give you the very first part of it - the input() built-in function allows you to solicit and store strings from the user within the command-line.
This will prompt input from the user, printing the string passed to input() before the caret:
input("Please enter something: ")
A string is returned from input() when the user hits enter, which can then be stored in a variable:
user_data = input("Please enter something: ")
Then, what you need to do is fourfold:
- Figure out what data types the price and quantity are, and how to ensure that the user data fits those parameters.
- Figure out how to combine the quantity and price for any item into a single total price.
- Figure out how to add the tax onto that.
- Output that value.
Here's a tutorial oninput and output in Python.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…