Python(全栈)01

回顾:

 

"""
编译型 : 一次性将代码编译成二进制文件
C,C++ 执行效率快,开发速度慢,不能跨平台运行
解释型 : 运行时,从上至下一行行解释成二进制文件
Python
开发速度快,效率高;运行效率慢。

Python2x ;Python3x 宏观区别 :
Python2x源码,重复率高,不规范;Python崇尚简约清晰,Python3x更加规范。

Python2x中文报错,<首行>添加:-*- coending:utf-8 -*-

变量:由数字,字母,下划线任意组合,且不能以数字开头,可描述性
不能关键字,默认不用中文及拼音

常量:Python无常量,约定俗称,不可更改,大写。

注释 当行:# 多行:""" ,'''

用户交互:数据类型为Str

基础数据类型:bool(True,False) int(+-*/) str("",+ 连接)

if 条件: 结果 ;if 条件:结果 else: 结果 ;if 条件: 结果 elif 条件:结果 else: 结果
嵌套if: if 条件:结果 if 条件:结果 else: 结果

while 条件: (‘:’,标识符,原因是Python崇尚简单优美)
结果
1.改变条件
2.break

continue 条件重置,重新开始
"""

 


#-*- 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)

'''

posted @ 2019-07-19 22:03  yanPy  阅读(131)  评论(0)    收藏  举报