#python day01 初识python 学习视频来源于 太白金星

#初识python 学习视频来源于 太白金星
#print('你好中国')


#版本控制
#python.exe 改为 python2.exe
#python2.exe d:test.py #使用2.7版本执行测试程序
#python.exe d:test.py #使用3.7版本执行测试程序

#中文显示 指定编码 (使用python2.7,不报错,但显示乱码)
#-*- encoding:utf-8 -*-

#注释
#单行 #
#多行''' ''' 3个单引号 或双引号

#变量 常量
'''
1.只能使用数字字母和下划线
2.不能以数字开头
3.变量名必须有意义

_ = 0
__ =3

#这种变量命名是可以的
常量一般以大写字母命名

'''
'''
a=1+2+3+4
print(a)
b=a*5
print(b)
c='你好中国'
print(c)
'''

#长字符串定义
msg='''

鹅鹅鹅
曲项向天歌
白毛浮绿水
红掌拨清波
'''
#print(msg)

#字符串转换为数字 int("73")
#数字转换为字符串 str(73)

# type() 检查数据类型
'''
print(100,type(100))
print("100",type("100"))
'''

#用户交互
'''
name = input("请输入名字:")
age = input("请输入年龄:")
print('我叫'+name,'我今年'+age+'岁')
'''

#循环控制 if
'''
if 5>4 :
print(666)
'''
'''
num = int(input('请输入数字:'))
if num == 1:
print('1')
elif num == 2:
print('2')
else:
print('没这么玩的!')
'''
#循环控制 while break continue

'''
c =1
while c<=100:
print(c)
c = c +1
'''
'''
c =0
while True:
c = c +1
if c%2==1:continue
if c>100: break
print(c)
'''
#day1 总结
#print('打印函数')
#-*- encoding:utf-8 -*- #指定编码
#单行注释 #
#多行注释 ''' ''' 3个单引号 或双引号
#input
#if elif else
#while
#int()
#str()
#break
#continue
#True False

猜你喜欢

转载自www.cnblogs.com/ham-731/p/10356824.html