资源简介
解压后直接在pycharm里运行即可

代码片段和文件信息
#!/user/bin/env python
import sys
salay=int(raw_input(‘plase input your salay:‘ ))
products=[
[‘iphone‘5900]
[‘macpro‘12000]
[‘NB‘680]
[‘cigarate‘48]
]
shopping_list = []
while True:
for p in products:
print products.index(p)p[0]p[1]
choice = raw_input(“\033[32;1mPlease choice sth to buy:\33[0m“).strip()
if choice == ‘quit‘:
print “You have bought below stuff:“
for i in shopping_list:
print ‘\t‘i
sys.exit(‘Goodbye!‘)
if len(choice) == 0:continue
if not choice.isdigit():continue
choice = int(choice)
pro = products[choice]
if salay >= pro[1]: #means you can afford this
salay = salay - pro[1]
shopping_list.append(pro)
print “\033[34;1mAdding %s to shopping listyou have %s left\033[0m“ % (pro[0]salay)
else:
print ‘The price of %s is %syet your current balance is %sso try another one!‘ % (pro[0]pro[1]salay)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-04-18 10:48 shoppinglist\.idea\
文件 687 2016-04-14 18:06 shoppinglist\.idea\misc.xm
文件 276 2016-04-18 10:48 shoppinglist\.idea\modules.xm
文件 398 2016-04-14 18:09 shoppinglist\.idea\shoppinglist.iml
文件 24545 2016-04-18 10:48 shoppinglist\.idea\workspace.xm
文件 901 2016-04-15 15:09 shoppinglist\shopping.py
- 上一篇:是AI就躲个飞机-纯Python实现人工智能
- 下一篇:EM算法Python实现
相关资源
- Python-BDD100K大规模多样化驾驶视频数据
- Instant Pygame for Python Game Development How
- Biopython Tutorial
- Think Python 2nd
- 一个小小的表白程序(python)
- Python课堂笔记(高淇400集第一季)
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
评论
共有 条评论