国内产品推广网站,wordpress的分类,建筑工程网上叫什么,网站首页设计特点有哪些1.day1作业讲解 题目答案见day1 2.格式化输出 %占位符#xff0c;s:字符串#xff0c;d#xff1a;数字 %%只是单纯的显示%#xff08;显示的%是后面的#xff09; 1 #格式化输出2 # % s d3 # name input(请输入姓名)4 # age input(请输入年龄)5 # height input(请输入…1.day1作业讲解 题目答案见day1 2.格式化输出 %占位符s:字符串d数字 %%只是单纯的显示%显示的%是后面的 1 #格式化输出2 # % s d3 # name input(请输入姓名)4 # age input(请输入年龄)5 # height input(请输入身高)6 # msg 我叫%s今年%s 身高 %s %(name,age,height)7 # print(msg)8 9 name input(请输入姓名:)
10 age input(请输入年龄:)
11 job input(请输入工作:)
12 hobbie input(你的爱好:)
13
14 msg ------------ info of %s -----------
15 Name : %s
16 Age : %d
17 job : %s
18 Hobbie: %s
19 ------------- end ----------------- %(name,name,int(age),job,hobbie)
20 print(msg)
21
22 name input(请输入姓名)
23 age input(请输入年龄)
24 height input(请输入身高)
25 msg 我叫%s今年%s 身高 %s 学习进度为3%%s %(name,age,height)
26 print(msg) 3.while else语句 1 count 02 while count 5:3 count 14 if count 3:break5 6 print(Loop,count)7 8 else:9 print(循环正常执行完啦)
10 print(------ out of while loop ------) 注当while循环被break打断就不会执行else的结果 4.初始编码 01010100 新11010000 开11010100 一01100000 家11000000 看11000000 看01010100011101110101011110110A B C01000001 01000010 01000011电报电脑的传输存储都是01010101最早的密码本 ascii 涵盖了英文字母大小写特殊字符数字。01010101ascii 只能表示256种可能太少创办了万国码 unicode 16表示一个字符不行32位表示一个字符。 A 01000001010000010100000101000001 B 01000010010000100100001001000010 我 01000010010000100100001001000010Unicode 升级 utf-8 utf-16 utf-32 8位 1字节bytes utf-8 一个字符最少用8位去表示英文用8位 一个字节 欧洲文字用16位去表示 两个字节 中文用24 位去表示 三个字节 utf-16 一个字符最少用16位去表示gbk 中国人自己发明的一个中文用两个字节 16位去表示。110000001bit 8bit 1bytes1byte 1024byte 1KB1KB 1024kb 1MB1MB 1024MB 1GB1GB 1024GB 1TB 5.逻辑运算 1.优先级 () not and or 2.int ---- bool (数字转换成布尔值) 非零转换成bool True 0 转换成bool 是False 3.x or y x True则返回x 4.x and y x True则返回y 1 # and or not2 #优先级 () not and or3 #print( 2 1 and 1 4 )4 #print ( 2 1 and 1 4 or 2 3 and 9 6 or 2 4 and 3 2)5 # T or T or F6 #T or F7 # print(34 or 43 and 11) # F8 # print(1 2 and 3 4 or 12) # T9 # print(2 1 and 3 4 or 4 5 and 2 1) # T
10 # print(1 2 and 3 4 or 4 5 and 2 1 or 9 8) # F
11 # print(1 1 and 3 4 or 4 5 and 2 1 and 9 8 or 7 6) # F
12 # print(not 2 1 and 3 4 or 4 5 and 2 1 and 9 8 or 7 6) # F
13
14
15 #ps int ---- bool (数字转换成布尔值) 非零转换成bool True 0 转换成bool 是False
16 # print(bool(2))#T
17 # print(bool(-2))#T
18 # print(bool(0))#F
19 # #bool ---int
20 # print(int(True)) # 1
21 # print(int(False)) # 0
22
23
24 x or y x True则返回x
25 # print(1 or 2) # 1
26 # print(3 or 2) # 3
27 # print(0 or 2) # 2
28 # print(0 or 100) # 100
29
30
31 # print(2 or 100 or 3 or 4) # 2
32
33 # # print(0 or 4 and 3 or 2)
34
35
36 # x and y x True则返回y
37 # # print(1221Q 1234
38 # 。and 2)
39 # # print(0 and 2)
40 print(2 or 1 3)
41 print(3 1 or 2 and 2) 转载于:https://www.cnblogs.com/gcs888/p/10733214.html