if continue_shopping=='N': if shopping_list == []: print("\033[31;1mYou haven't bought anything yet.\033[0m") else: print('---Shopping list---') for j in shopping_list: print(shopping_list.index(j), j) print('\033[31;1mYour balance is %s.Thank your shopping.\033[0m' ...
("ipad",3896), ("phone",3299), ("headset",2199), ("vip",999) ] shopping_list=[] salary=input("your salary is:") if salary.isdigit(): salary=int(salary) while True: for index,item in enumerate(product_list): print(index,item) user_choice=input("please choose which you wanna:"...
('Python书籍',120), ] shopping_list = [] salary = input("输入你的工资:")while True:if salary.isdigit(): salary = int(salary)while True:for index, item in enumerate(product_list):#print(product_list.index(item),item)print (index,item) user_choice = input("请选择您要购买的商品?>>...
use "if item in shopping_list" instead of "try except" ... What is the difference between my code def remove_item_from_list():item_to_be_removed = input("What do you want to remove?\n> ")if item_to_be_removed in shopping_list:shopping_list.remove(item_to_be_removed)else:print(...
python 基础巩固(7 ;" #定义一个列表,模拟购物车 shopping_cart = [] #增加 shopping_cart.append('iPhone XS Max 256G') shopping_cart.append('ThinkPad T440P') shopping_cart.insert(0,'awm') print(shopping_cart) list1 = [1,2 商城——购物车模块 在项目中添加商城购物结算模块: 将应用注册...
Jacob Corkran is having issues with: If you are having issues when loading your saved shopping list were it continually adds \n to each item creating spaces in your saved list, this...
Python 3.8+ ScyllaDB cluster (withScyllaDB Cloudoruse Docker) Connect to your ScyllaDB cluster usingCQLSHand create theschema: Then, install the Python requirements in a new environment: Modifyconfig.pyto match your database credentials: Run the server: ...
('Python书籍',120), ] shopping_list=[] salary= input("输入你的工资:")whileTrue:ifsalary.isdigit(): salary=int(salary)whileTrue:forindex, iteminenumerate(product_list):#print(product_list.index(item),item)print(index,item) user_choice= input("请选择您要购买的商品?>>>:")ifuser_choice...
shopping list # _*_coding:utf-8_*_ # Author:len liu ''' user_passwd.txt 文件格式为 egon|egon123|len|len123|wxx|123|lxx|456 ''' shop_list = [ ("iphone",5000), ("coffer",80), ("疙瘩汤",50), ("python book",30), ("bike",800),...
Python tracking index position in for loop Postedon Jun 2, 2017bySam Fellows Sam Fellows 3,968 Points Continue Nikolas Boling 2,403 Points How to check each item in a list to see if it begins with the letter 'a'. Postedon Jun 2, 2017byNikolas Boling ...