自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(9)
  • 收藏
  • 关注

原创 学习Python第5天

#列表 [], 然后里面可以是任何类型的数据 12, 23.6,”“,[]#列表本质上是一个序列0 1 2 3name_list = ["James", "蔡徐坤", "罗志祥", "格林", 2022]#len表示列表长度print(name_list, type(name_list), len(name_list))#1、列表索引查询print(name_list[0])print(name_list[1])print(name_list[3])print(nam.

2022-02-27 21:38:18 174

原创 字符串操作3

#切分字符串language ="Python and Java and C++ and Golang and Scala"#split 切割字符串 生成一个列表:暂时理解为一个容器 有序序列result =language.split("and")print(result)#2、连接序列 生成字符串 跟split 是相反的操作lang =["Englist","Chinese","Jananese"]#通过 - 连接上面的语言result2 = "-".join(lang)print.

2022-02-27 21:36:35 568

原创 字符串操作2

# 定义一个字符串 字符串使用双引号或者单引号定义a = "Hello Python"b = 'abcdef'print(type(a))print(type(b))name1 = '晴小天'name2 = "帆顺"name3 = '''廖景观'''name4 = """胡航"""name5 = '''唐佳亮'''print(type(name1))print(type(name2))print(type(name3))print(type(name4))print(typ.

2022-02-27 21:34:45 293

原创 字符串操作1

# 统计字符串次数countcom_apply = "This class is very good, so good, people good, so amazing"# 计算good在字符串中的次数result1 = com_apply.count("good")print(result1)# 24,50是指定范围内 查找good 的次数result2 = com_apply.count("good", 24, 50)print(result2)print("============.

2022-02-27 21:30:27 87

原创 for循环应用

1、使用for循环打印***************2、使用for循环打印*********# i = 1# while i <= 5:# print(i)# i += 1print("===================")for i in range(1, 6): print("*" * i)print("===================")for i in range(1, 6): if i % 2 == 1:.

2022-02-27 21:28:53 55

原创 用Python写一个猜拳游戏

'''猜拳游戏石头(1)剪刀(2)布(3)电脑赢:1-2,2-3,3-1平局:1-1,2-2,3-3我赢:1-3,2-1,3-2'''import randomuser=int(input("请输入猜拳数字石头(1) 剪刀(2) 布(3):"))#computer是一个int类型computer =random.randint(1,3)print(computer,type(computer))if user ==computer: print("平局")elif(c.

2022-02-27 21:26:48 4471 1

原创 Python第三天

用break终止循环做一个吃苹果的循环#吃四个苹果i = 1while i <=4: print(f"吃第{i}个苹果") i += 1print("=================================")#吃四个苹果 吃到第三个我就饱了 不用吃第四个了i =1while i <= 4: print(f"吃第{i}给苹果") if i ==3: print("我吃饱了,毁灭吧,结束吧") #终止所有

2022-02-27 21:25:41 171

原创 Python学习的第二天

.

2022-02-27 21:21:04 126

原创 Pycharm学习第一天

Python菜鸡学习的第一天

2022-02-27 21:09:16 369

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除