.定义一个列表有五位同学的姓名 然后输入一个姓名可以知道列表中有没有这个同学
list =["杨福军123","郭川川","刘永杰"]# for i in range(0,len(list)):# 字符串比较的时候不能用in 表示list[i]中是否包含指定的name# if name in list[i]: # print("该同学存在")# 判断列表中是否包含name元素 可以用in # if name in list: """
if name in list:
print("该同学存在")
else:
print("该同学不存在")
"""whileTrue:
name = input("请输入查询的学生姓名")if name in list:
print("该同学存在")breakelse:
print("该同学不存在")
```sql
person1={"username":"刘亦菲","sex":"女","age":30}
person2={"username":"唐嫣","sex":"女","age":29,"address":"西北旺"}
person3={"username":"张一山","sex":"男","age":27,"address":"百望山"}
print(person1==person2)
person1 = person3
person2 = person1
print("person1==person2",person1==person2)# 结果:Trueprint("person3==person2",person2==person3)# 结果:Trueprint("person1的值为",person1)print("person2的值为",person2)print("person3的值为",person3)
person1["username"]="杨紫"print("person1的值为",person1)print("person2的值为",person2)print("person3的值为",person3)
a =100
b = a
c = b
a =300print("b的值为:",b)print("c的值为:",c)