首页 > 编程语言 > 详细

Python(全栈)01

时间:2019-07-19 22:36:11      阅读:105      评论:0      收藏:0      [点我收藏+]
#-*- encoding:utf-8 -*- //Python2 中文乱码解决方法
‘‘‘
if __name__=="__main__":
print("hello vscode")
name =1
print(name)
‘‘‘
# Python本身无常量,约定成俗为常量 SEX=‘男‘
# ‘‘‘,""" 两种多行注释
‘‘‘
print(type(100)) #没有Long,长整形。
print(‘a‘+‘b‘+‘c‘)
a = (1<3)
print(a)
‘‘‘
# 数据结果是 str.
‘‘‘
name=input("")
# Python if 使用
#第一种
if(4>5):
print("3")
#第二种
if(4>5):
print("a");
else:print("Error")
#第三种 多选
if 4<1:
print("a")
elif 4<2:
print("b")
else:
print("Error")
#第四种 嵌套if
if 4>1:
if 4>5:
print("a")
else:
print("Error")
else:
print("错了")
‘‘‘
#Python 循环语句
#打印 1-100
‘‘‘
count = 1
flag = True
#标志位
while flag:
print(count)
count = count+1
if count > 100:
flag=False
#
while count<=2:
print(count)
count = count+1

#While 计算1 - 100 之间的和
count=1
sum=0
while count<=100:
sum=sum+count # 得到计数
count=count+1
print(sum)
‘‘‘
# while break
‘‘‘
while True:
print("a")
print("b")
break
print("c")
# while break 1 -100
count=1
sum=0
while True:
sum=sum+count
count=count+1
if count>100:break

# continue
count = 1
while < 20 :
print(count)
continue #类似重置.
count=count+1

count = 0
while count <= 100 :
count = count + 1
if count > 5 and count <95 :
continue
print(count)
#使用continue 打印1 2 3 4 5 6 8 9 10

count = 0
while count < 10 :
count = count + 1
if count > 6 and count < 8:
continue
print(count)
‘‘‘

Python(全栈)01

原文:https://www.cnblogs.com/yanPy/p/11215949.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!