day1
#文件操作
fp = open('D:/text.txt','a+')
print('hello word',file = fp)
fp.close()
#变量有三个属性
name = '肖本杰'
print('内存',id(name))
print('类型',type(name))
print('值',name)
#变量字符串连接
name = '李四'
age = 378
print('我叫' +name+ '今年' +str(age)+ '岁')
#提示输入(默认变量为字符串类型)
input()返回值为str类型
a = int(input('请输入第一个加数'))
b = int(input('请输入第二个加数'))
print(a+b)
#整除运算
print(11//2) #//整除运算符 输出5
#次方运算
print(2**3) #表示2三次方
#链式赋值
a=b=c=20
#解包赋值
a,b,c=20,30,40
#交换两变量值
a,b=20,30
a,b = b,a
print(a,b) //输出30,20
#比较运算符(标识,类型,值)
>,<,>=,<=,!=,==是对vaue比较
is, is not 是对id比较
返回结果是布尔类型
a,b=20,30
print('a>b吗',a>b) //输出false
#逻辑运算符
a,b=1,2
s='hello word'
print(a==1 and b==2)
print(a==1 or b==3)
print(not a) //false
print('w' in s) //true
print('w' not in s) //false
#位运算
& | << >>
#分支结构
money=int(input('输入一个整数'))
if money<100:
print('金额小于100')
if money%2!=0:
print('金额为奇数')
else:
print('金额为偶数')
elif money>100 and money<200:
print('金额大于100小于200')
else:
print('金额大于200')



