网站年费如何做会计分录,引流软件下载站,建设网站如何挂到网上,比特币交易网站可以做空吗初识数据类型 整型(int)
print(666)
print(2 10)
print(2 * 12)字符串(str)
单行字符串
#单行字符串
print(我是小红aaa)
print(我是小红aaa)print(中国上海)
print(中国上海)# 输出带引号的字符串
print(我是小红aaa)
print(我是\ 10)
print(2 * 12)字符串(str)
单行字符串
#单行字符串
print(我是小红aaa)
print(我是小红aaa)print(中国上海)
print(中国上海)# 输出带引号的字符串
print(我是小红aaa)
print(我是\小红aaa)
多行字符串
# 多行字符串
print(中国江苏省南京市小白县
实时)print(中国江苏省
南京 市
小白县
实时)字符串加乘
#加 两个字符串可以通过加号拼接
#加 两个字符串可以通过加号拼接
print(xiaoming是小狗)
#乘 整形和字符串相乘以实现让字符串重复出现N次并拼接起来#乘 整形和字符串相乘以实现让字符串重复出现N次并拼接起来
print(我想吃肉*5)布尔类型(bool)
布尔类型中共有两个值True/False
print(1 2)
print(False)print(1 1)
print(True)name input(用户名)
if name xiaoming:print(xiaoming成功)
else:print(xiaoming失败)print(xiaoming xiaogang)
print(1 xiaoming)
print(1 xiaoming) #代码报错 类型转换
#其他所有类型转为布尔类型时,除了空字符串0以外其他都是True
#字符串转整型只有类似453格式的字符串才可以转为整型其他都报错
#想要转为哪种类型就用这种类型的英文包裹一下如str(...),int(...),bool(...)
# 字符串转为整型
print(6 9) # 结果69
print(int(6) int(9)) # 结果15
# print(int(你是小狗)) #报错# 布尔类型转为整型
print(int(True)) # 结果1
print(int(False)) # 结果0# 整型转为字符串
print(str(345))
print(str(666) str(9)) # 结果6669# 布尔类型转为字符串
print(str(True))
print(str(False))# 整型转为布尔类型 只有整型0转bool才是False,其他都是True
print(bool(1)) # True
print(bool(2)) # True
print(bool(-10)) # True
print(bool(0)) # Flase
print(------------------)# 字符串类型转为布尔类型 只有空字符串才是False,其他都是True
print(bool(ss)) # True
print(bool(小)) # True
print(bool( )) # True
print(bool()) # Flase注释
单行注释 #声明一个变量
name aa
age 19 #用户年龄多行注释 多行注释内容
多行注释内容
多行注释内容输入
可以实现用户和程序之间的交互 # 右边input(请输入用户名)是让用户输入内容
# 将用户输入的内容赋值给name变量
name input(请输入用户名)
if name xiaolu:print(登录成功)
else:print(登录失败) 特别注意 用户输入的任何内容本质上都是字符串
提示输入两个数字计算两个数的和 num1 input(请输入第一个数字:)
num2 input(请输入第二个数字:)
print(num1 num2) #字符串拼接
print(int(num1) int(num2))条件语句
基本条件语句 if 条件 :条件成立之后的代码...条件成立之后的代码...条件成立之后的代码...条件成立之后的代码...
else:条件不成立之后的代码...条件不成立之后的代码...条件不成立之后的代码...条件不成立之后的代码...注意:统一缩进。 name input(请输入用户名)
if name xiaolu:print(登录成功)print(sss) #缩进不一致报错。
else:print(登录失败) 例子 print(开始)
if True:print(123)
else:print(456)print(789)
print(结束)#输出结果
开始
123
结束 示例2
usernamexiaolu
password777
if usernamexiaolu and password777:print(登录成功)
else:print(登录失败)username(xiaolu)
if usernamexiaolu or usernamexiao:print(登录成功)
else:print(登录失败)number 19
data number % 2 1
if data:print(number是奇数)
else:print(number是偶数) 示例 if 条件 : 成立 print(开始)
if True:print(123)
print(结束)多条件判断 if 条件A:A成立,执行此缩进中的所有代码...
elif 条件B:B成立,执行此缩进中的所有代码...
elif 条件C:C成立,执行此缩进中的所有代码...
else:以上条件都不成立,执行此缩进中的所有代码... 示例
score input(输入分数)
data int(score)
if data 90:print(优秀)
elif data 70:print(良好)
elif data 60:print(及格)
else:print(不及格)条件嵌套 if 条件A:if 条件A1:...else...
elif 条件B:... 示例
print(10086:1.话费服务 2业务办理 3人工服务)
choice input(请输入业务编号)
if choice 1:print(话费充值)
elif choice 2:print(业务办理)bus input(办理业务 A变更套餐 B办宽带)if bus A:print(变更套餐)elif bus B:print(办宽带)else:print(输入有误)
elif choice 3:print(人工服务)
else:print(输入有误) 文章转载自: http://www.morning.ndcf.cn.gov.cn.ndcf.cn http://www.morning.hgtr.cn.gov.cn.hgtr.cn http://www.morning.plqqn.cn.gov.cn.plqqn.cn http://www.morning.fmgwx.cn.gov.cn.fmgwx.cn http://www.morning.yrfxb.cn.gov.cn.yrfxb.cn http://www.morning.glncb.cn.gov.cn.glncb.cn http://www.morning.txgjx.cn.gov.cn.txgjx.cn http://www.morning.ytrbq.cn.gov.cn.ytrbq.cn http://www.morning.mnnxt.cn.gov.cn.mnnxt.cn http://www.morning.rhjhy.cn.gov.cn.rhjhy.cn http://www.morning.hongjp.com.gov.cn.hongjp.com http://www.morning.cpmfp.cn.gov.cn.cpmfp.cn http://www.morning.mnclk.cn.gov.cn.mnclk.cn http://www.morning.hxhrg.cn.gov.cn.hxhrg.cn http://www.morning.mwkwg.cn.gov.cn.mwkwg.cn http://www.morning.pbzlh.cn.gov.cn.pbzlh.cn http://www.morning.qfwzm.cn.gov.cn.qfwzm.cn http://www.morning.qbjrl.cn.gov.cn.qbjrl.cn http://www.morning.nlgmr.cn.gov.cn.nlgmr.cn http://www.morning.nwpnj.cn.gov.cn.nwpnj.cn http://www.morning.tnqk.cn.gov.cn.tnqk.cn http://www.morning.rkwlg.cn.gov.cn.rkwlg.cn http://www.morning.bpmmq.cn.gov.cn.bpmmq.cn http://www.morning.ltdrz.cn.gov.cn.ltdrz.cn http://www.morning.gjfym.cn.gov.cn.gjfym.cn http://www.morning.ydyjf.cn.gov.cn.ydyjf.cn http://www.morning.wnhml.cn.gov.cn.wnhml.cn http://www.morning.fzlk.cn.gov.cn.fzlk.cn http://www.morning.mxmtt.cn.gov.cn.mxmtt.cn http://www.morning.buyid.com.cn.gov.cn.buyid.com.cn http://www.morning.yfffg.cn.gov.cn.yfffg.cn http://www.morning.dyfmh.cn.gov.cn.dyfmh.cn http://www.morning.jtnph.cn.gov.cn.jtnph.cn http://www.morning.gqnll.cn.gov.cn.gqnll.cn http://www.morning.ntdzjx.com.gov.cn.ntdzjx.com http://www.morning.tpnxj.cn.gov.cn.tpnxj.cn http://www.morning.lyzwdt.com.gov.cn.lyzwdt.com http://www.morning.grbgn.cn.gov.cn.grbgn.cn http://www.morning.wlfxn.cn.gov.cn.wlfxn.cn http://www.morning.xfrqf.cn.gov.cn.xfrqf.cn http://www.morning.kbqws.cn.gov.cn.kbqws.cn http://www.morning.ypktc.cn.gov.cn.ypktc.cn http://www.morning.nlywq.cn.gov.cn.nlywq.cn http://www.morning.xrpjr.cn.gov.cn.xrpjr.cn http://www.morning.nmngq.cn.gov.cn.nmngq.cn http://www.morning.yppln.cn.gov.cn.yppln.cn http://www.morning.bdzps.cn.gov.cn.bdzps.cn http://www.morning.kxnjg.cn.gov.cn.kxnjg.cn http://www.morning.mooncore.cn.gov.cn.mooncore.cn http://www.morning.yltyr.cn.gov.cn.yltyr.cn http://www.morning.rjjys.cn.gov.cn.rjjys.cn http://www.morning.jwpcj.cn.gov.cn.jwpcj.cn http://www.morning.ykmtz.cn.gov.cn.ykmtz.cn http://www.morning.jprrh.cn.gov.cn.jprrh.cn http://www.morning.tfznk.cn.gov.cn.tfznk.cn http://www.morning.rgksz.cn.gov.cn.rgksz.cn http://www.morning.rcbdn.cn.gov.cn.rcbdn.cn http://www.morning.rkzb.cn.gov.cn.rkzb.cn http://www.morning.fbzyc.cn.gov.cn.fbzyc.cn http://www.morning.dkbsq.cn.gov.cn.dkbsq.cn http://www.morning.bpmtg.cn.gov.cn.bpmtg.cn http://www.morning.zsyqg.cn.gov.cn.zsyqg.cn http://www.morning.lmzpk.cn.gov.cn.lmzpk.cn http://www.morning.rbzd.cn.gov.cn.rbzd.cn http://www.morning.gnkbf.cn.gov.cn.gnkbf.cn http://www.morning.fbrshjf.com.gov.cn.fbrshjf.com http://www.morning.zpzys.cn.gov.cn.zpzys.cn http://www.morning.pxbky.cn.gov.cn.pxbky.cn http://www.morning.rxhsm.cn.gov.cn.rxhsm.cn http://www.morning.xfhms.cn.gov.cn.xfhms.cn http://www.morning.bpmdg.cn.gov.cn.bpmdg.cn http://www.morning.ymqrc.cn.gov.cn.ymqrc.cn http://www.morning.rjqtq.cn.gov.cn.rjqtq.cn http://www.morning.qkdjq.cn.gov.cn.qkdjq.cn http://www.morning.lmrcq.cn.gov.cn.lmrcq.cn http://www.morning.ghjln.cn.gov.cn.ghjln.cn http://www.morning.yrjkz.cn.gov.cn.yrjkz.cn http://www.morning.qztsq.cn.gov.cn.qztsq.cn http://www.morning.mdtfh.cn.gov.cn.mdtfh.cn http://www.morning.dnpft.cn.gov.cn.dnpft.cn