顺昌网站建设wzjseo,小程序和wordpress,wordpress 详细介绍,网站关键词密度怎么计算的1#xff0c;格式化输出#xff0c;%s %d 2#xff0c;复习昨日讲题 编译型#xff1a; 将代码一次性全部编译成二进制#xff0c;然后运行。 优点#xff1a;执行效率高。 缺点#xff1a;开发效率低#xff0c;不能跨平台。 C解释型#xff1a; 代码…1格式化输出%s %d 2复习昨日讲题 编译型 将代码一次性全部编译成二进制然后运行。 优点执行效率高。 缺点开发效率低不能跨平台。 C解释型 代码逐行解释边解释边执行。 优点开发效率高可以跨平台。 缺点执行效率低。 python变量 1必须由数字字母下划线任意组合。 2 数字不能开头。 3不能是Python中的关键字。 4不能是中文。 5不能太长。 6要具有可描述性。常量不能改变的量全部大写的变量为常量放在文件起始。基础数据类型int 运算。str 被引号引起来的都是字符串。 拼接。str str * str * int。bool TrueFalse用户输入input python2x: raw_input() input() 相当于eval() python3x: input()if if 条件: pass if 条件: pass else: pass if 条件: pass elif 条件 pass elif 条件 pass if 条件: pass elif 条件 pass elif 条件 pass else: pass if 条件 if ... else: pass else: if.. else:...while 条件: passbreak:直接跳出当前循环。continue:结束本次循环继续下一次循环。 3while else 6讲解昨天作业上6道题 1、使用while循环输入 1 2 3 4 5 6 8 9 102、求1-100的所有数的和3、输出 1-100 内的所有奇数4、输出 1-100 内的所有偶数5、求1-23-45 ... 99的所有数的和6、用户登陆三次机会重试# 1、使用while循环输入 1 2 3 4 5 6 8 9 10# count 1# while count 11:# if count 7:# count 1# print(count)# count 1# 5、求1-23-45 ... 99的所有数的和# sum 0# count 1# while count 100:# if count % 2 0:# sum sum - count# else:# sum sum count# count 1# print(sum)# 6、用户登陆三次机会重试# i 0# while i 3:# username input(请输入用户名)# password input(请输入密码)# if username 婉容 and password 123:# print(登录成功)# break# else:# print(用户名或者密码错误请重新输入)# i 1 4运算符 # print(2 1 and 3 4 or 8 10 and 4 5)# 第一种情况 逻辑运算符前后都是比较运算# 优先级概念() not and or,同一优先级从左至右以此计算。# print(2 1 and 3 4 or 4 5 and 2 1) # T# print(1 2 and 3 4 or 4 5 and 2 1 or 9 8) # F# print(1 1 and 3 4 or 4 5 and 2 1 and 9 8 or 7 6) # F# 第二种情况 逻辑运算符前后都是数字x or y if x True,return x,else y# print(3 or 5)# print(2 or 5)# print(0 or 5)# print(-4 or 5)# print(3 and 5)# print(1 or 3 or 4 or 0)# print(1 or 3 or 0)# print(1 2 and 3 or 4)数字与bool值转化int --- bool 非零 True 零 Falsebool--- int True 1, False 0,# print(bool(100))# print(bool(0)) 7格式化输出 # name input(请输入名字)# age input(请输入年龄)# sex input(请输入性别)## msg 我的名字是 name 我的年龄是 age 我的性别是 sex# print(msg)msg ------------ info of Alex Li -----------Name : Alex LiAge : 22job : TeacherHobbie: girl------------- end -----------------# 格式化输出 %占位符 s d# name input(请输入姓名)# age int(input(请输入年龄))# job input(请输入工作)# hobbyinput(请输入爱好)## msg # ------------ info of %s -----------# Name : %s# Age : %d# job : %s# Hobbie: %s# ------------- end -----------------# % (name, name, age, job, hobby)# print(msg)#第二种使用方法# dic {# name:老男孩,# age:58,# job:boss,# hobby:money,# }# msg # ------------ info of %(name)s -----------# Name : %(name)s# Age : %(age)d# job : %(job)s# Hobbie: %(hobby)s# ------------- end -----------------# % dic# print(msg)# 格式化输出在格式化输出中单纯的表示% 需要用%% 去表示。# msg 我叫%s,今年%s,学习进度2%% % (爽妹儿,18)# print(msg)#while else 当while循环被break打断则不走else程序。# count 0# while count 5:# count 1# print(Loop,count)# if count 4: break## else:# print(循环正常执行完啦)# print(-----out of while loop ------) 5编码初始 谍战片嘀嘀嘀 滴滴 高低电平0101010电脑文件的存储与文件的传输 010101010初级密码本 :ascii 字母数字特殊字符。 0000 0001 8位 1个字节 一个字节表示一个字符。 字符组成内容的最小单元。 abc a b c 中国 中 国 a 01100001 b 01100010 c 01100011万国码unicode 创建初期 16位 两个字节表示一个字符。 a 01100001 01100001 中01100011 01100001 升级32位 四个字节表示一个字符。 a 01100001 01100001 01100001 01100001 中01100011 01100001 01100011 01100001 资源浪费。对Unicode升级 utf-8。 utf-8:最少用8位数去表示一个字符。 a:01100001(字母用1个字节表示。) 欧洲文字01100001 01100001(欧洲用2个字节表示。) 亚洲文字——中01100001 01100001 01100001 (欧洲用3个字节表示。) utf-16:最少用16位数去表示一个字符gbk国家标准。 a : 01100001 中: 01100001 011000018位 1个byte1024bytes 1kb1024kb 1MB1024MB 1GB1024GB 1TB转载于:https://www.cnblogs.com/juxiansheng/p/8963611.html