Python自学笔记
LudoArtificis
还在努力学习的游戏制作者
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【Python自学笔记】EX28-EX31 python判断语句
# ex28 布尔运算的练习print(1, True and True)print(2, False and True)print(3, 1 == 1 and 2 == 1)print(4, "test" == "test")print(5, 1 == 1 and 2 != 1)print(6, True and 1 == 1)print(7, False and 0 != ...原创 2018-08-26 07:48:04 · 320 阅读 · 0 评论 -
【Python自学笔记】EX11-EX14 用户的输入
# ex11# 获取输入input()# 用end=' '来告诉print函数,不要以换行符作为结尾开始新的一行print("How old are you?", end=' ')age = input()print("How tall are you?", end=' ')tall = input()print("How much do you weight?", end=' ...原创 2018-08-22 09:28:41 · 255 阅读 · 0 评论 -
【Python自学笔记】EX15-EX17 对文件的操作
# ex15# 打开文件并读取文件内容from sys import argvscript, filename = argvtxt = open(filename) # 根据文件名打开文件print(f"Here's your file {filename}:")print(txt.read()) # 读取该文件中的文本并输出print("Type the filename ...原创 2018-08-22 10:14:35 · 269 阅读 · 0 评论 -
【Python自学笔记】EX18-EX21 python的函数
# ex18# 定义与使用函数def print_two(*args): # 定义格式 def 函数名(参数名) arg1, arg2 = args print(f"arg1: {arg1}, arg2: {arg2}")def print_two_agagin(arg1, arg2):# 此函数方法与上个函数一致 print(f"arg1: {arg1}, ar...原创 2018-08-24 09:18:26 · 3641 阅读 · 0 评论 -
【Python自学笔记】EX24-EX25 对前面部分的总结与练习
# ex24 更多的练习print("Let's practice everything.")# python的输出,转义字符的运用print('You\'d need to know \'bout escapes with \\ that do:') # You'd need to know 'bout escapes with \ that do:print('\n newline...原创 2018-08-24 12:34:38 · 338 阅读 · 4 评论 -
【Python自学笔记】EX1-EX10 python的输出等
# ex1 直接输出字符串,用print函数# ex2 python的注释用“#”print("Hello World") # 可以注意到python不加分号结尾# ex3 python的数字和数学计算# python的数字变量也无需考虑类型,为保证精确度,在计算除法时,python似乎会把整型相除的结果输出为浮点型# 而其他的运算则根据变量的类型来决定a = 10b ...原创 2018-08-21 22:16:16 · 467 阅读 · 0 评论 -
【Python自学笔记】EX32 循环和list
【Python自学笔记】EX32 循环和listex32 Loop and Lists示例代码一些思考ex32 Loop and Lists示例代码the_count = [1, 2, 3, 4, 5]fruits = ['apples', 'oranges', 'pears', 'apricots']change = [1, 'pennies', 2, 'dimes', 3, 'qua...原创 2019-06-12 22:09:23 · 367 阅读 · 0 评论 -
【Python自学笔记】EX33 While Loops
ex32 Loop and Lists示例代码i = 0numbers = []while i < 6: print(f"At the top i is {i}") numbers.append(i) i = i + 1 print("Numbers now: ", numbers) print(f"At the bottom i is {...原创 2019-06-13 22:02:15 · 323 阅读 · 0 评论
分享