Job to show:Shopping Cart Procedure:After starting the program, enter the user name password, if it is the first time to log in, let the user enter the payroll, and then print the product listAllow users to purchase items based on their product numberAfter the user selects the product, checks whether the balance is enough, enough on the direct debit, enough to remindYou can exit at any time to print the purchased goods and balances when exitingIn the
Python Job Day2 Shopping CartOriginal: https://www.cnblogs.com/spykids/p/5163108.htmlFlow chart:Implementation situation:Can be self-registered,Landing system can be shopping, recharge (temporarily not implemented), check the balance.Two days and a night of code, do not say, directly on the code, comment on the back of God HorsePress CTRL + C to copy code press
: - #print (P_name,p_price) #由于此方法后面打印下标时, will turn into 2 no groups, so use the following method of printing - forIteminchEnumerate (product_list): inindex=Item[0] -P_name=item[1][0] toP_price=item[1][1] + Print(Index,'.', P_name,p_price) -User_choice = input ('[Q=quit,c=check]what does want to buy?:') the ifUser_choice.isdigit ():#must be the choice of goods *User_choice =Int (user_choice) $ ifUser_choice Len (product_list):Panax NotoginsengP_item =Product_lis
The first Pyhone program, simple shopping cart function, just start learning, practice the feeling.#/usr/bin/env python#-*-Coding:utf-8-*-salary = Int (raw_input ("Please enter your salary:"). Strip ())Shop_list=[[1, ' iphone6s ', 5800],[2, ' Mac book ', 9000],[3, ' Coff ', 32],[4, ' Python book ', 80],[5, ' Bicyle ',
1, after starting the program, enter the user name password, if it is the first time to log in, let the user enter wages, and then print the product list2. Allow users to purchase goods according to the product number3, the user selects the goods, checks whether the balance is enough, enough on the direct debit, not enough on the reminder4, can withdraw at any time, exit, print purchased goods and balance5, in the user process, the key output, such as the balance, the product has been added to t
Functional Requirements:
Require users to enter the total assets, such as: Index
display list of goods, so that users select goods according to the serial number, add shopping cart
purchase, if the total amount of merchandise is larger than the total assets, suggesting that the account balance is insufficient, otherwise, the purchase success.
Additional: Can recharge, a product to remove the
1 #Author:ersa2 " "3 Program: Shopping Cart Program4 5 Requirements:6 7 After you start the program, let the user enter the payroll, and then print the list of items8 allow users to purchase items based on their product number9 after the user selects the product, checks whether the balance is enough, enough on the direct debit, enough to remindTen you can exit at any time to print the purchased goods and ba
This article mainly for you in detail the Python shopping cart program simple code, with a certain reference value, interested in small partners can refer to
The example of this article for you to share the Python shopping cart p
#!/usr/bin/env python#_ *_ Coding:utf-8 _*_#Author: Liujindong#datetime: 2018/6/11 16:34‘‘‘This program is a shopping cart program, including user portal, merchant entrance.User Portal: Purchased goods, Balance records.Merchant Entrance: You can add goods, modify the price of the goods.‘‘‘Import Time,sysdef business_entrance (productlist):F1=open (productlist, '
This small program shopping process is:Start-up welcome, prompt to enter the purchase budget amount, print shopping menu, select goods, products can be repeatedly selected to purchase, when the purchase budget amount is less than the amount of goods purchased, return to the shopping list and prompt budget amount is insufficient.#!/usr/bin/
Enter the salary, get the shopping list, if the amount is enough, put the item in the shopping list, complete the purchase, show the shopping list.Roduct_list = [(' Iphone ', 5800), (' Mac Pro ', 9800), (' Bike ', "+"), (' Watch ', 10600), (' Coffee ', '), (' Pytho n ', +),]shopping_list = []salary = input ("Input your Salary:") if Salary.isdigit (): sala
#Readme:#Ne_zha#blogger Address:www.cnblogs.com/ne-zha#Requirements:#1. Start the program, let the user enter the deposit, and then print the product list#2. Allow users to select items based on their product number#3. After the user selects the product to check whether the balance is sufficient to deduct the money, satisfies the prompt deduction the success, does not satisfy the prompt balance insufficient#4. You can exit at any time and print the purchased goods and balances upon exitSavings=i
it is a number or quit# Nesting of conditional judgments is critical, where is it opened? Look at the terminating line, backward from the terminating line# If you enter an error at the beginning, you need to terminate it immediately, so start with the first input judgment# ideas. Part3# Set a judgment bit to control when the while loop is interrupted# Set a cost value to save how much money you spent# need to determine if the number entered is out of rangeItem_list = [(' iphone ', 6800), (' Swa
#!/user/bin/env python#一个购物车的程序"Demand:Start the shopping cart, let the user enter the payroll, and then print the list of itemsAllow users to purchase items based on their product numberAfter the user selects the product, checks whether the balance is enough, enough on the direct debit, otherwise the reminderYou can exit at any time and print the purchased goods
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.