- 博客(7)
- 收藏
- 关注
原创 用python写购物车
#还在新手村不喜勿喷#菜单模式products = [["iphone",6888],["MacPro",14800],["小米6",2499],["Coffee",31],["Book",60], ["Nike",699]]list=[]total=0while(1): i=0 print("-"*8+"\t"+"商品"+"\t"+"-"*8) for tempNames in products: print(i,end="\t") f...
2022-07-12 02:29:36
162
1
原创 python入门
# -*- codeing =utf-8 -*-# @Time : 2022/7/11 22:31# @Author : ph# @File : demo14.py# @software : PyCharm#一.列表定义'''#namelist=[] #定义一个空列表namelist=["王","李","林"]print(namelist[0])#王namelist1=["王",2,"林"] #支持不同类型字符串 不改变其类型print(namelist1[1])#2print(t.
2022-07-11 23:51:47
106
原创 python入门
记录摸鱼生活# -*- codeing =utf-8 -*-# @Time : 2022/7/11 20:24# @Author : ph# @File : demo.py# @software : PyCharm#1.string(字符串):可用单引号、双引号、三引号表示str'''"word='字符串'sentence="这是一个句子"paragraph="""这是一个段落可写多行"""print(word)print(sentence)print(paragrap.
2022-07-11 23:48:32
114
原创 用python写九九乘法表
#题目要求用while和for写 随便编了#九九乘法表i=1while i<=9: for n in range(1,i+1):#例如range(2)的话就是从0-1 所以要 range(1,i+1) if i==n: print(i*i,end="\n") else: print(i*n,end="\t") n+=1 i+=1...
2022-07-10 23:29:34
106
1
原创 python入门
# -*- codeing =utf-8 -*-# @Time : 2022/7/10 13:41# @Author : ph# @File : demo11.py# @software : PyCharm#用CSDN记录美好摸鱼生活#p5 for知识点# for i in range(5):#0-4# print(i)''''for i in range(0,10,3): #0-4 print(i)0369'''#p5 逐一读取数据知识点# ...
2022-07-10 23:27:42
88
原创 用python写猜拳游戏
记录摸鱼生活罢了#猜拳游戏import randomcomputer=random.randint(0,2)user=int(input("请输入数字0-2中的一个数字"))# 剪刀=0# 石头=1# 布=2if user>2 or user<0: print("您输入为error") print("pc数字为%d"%computer)else: if user==0: s="剪刀" elif user==1: ...
2022-07-10 23:25:10
470
1
原创 python入门
记录一下摸鱼生活#第一个程序随便写写 单行注释井号# print('hello ph') ctrl+/也可以注释'''双行注释 三个单引号'''# -*- codeing =utf-8 -*- 方便中文注释不发生改变# @Time : 2022/7/10 13:41# @Author : ph# @File : demo11.py# @software : PyCharm'''print("我的名字%s,我的国籍是 %s"('ph','China'))print('aa..
2022-07-10 23:21:12
221
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人