作业

1区别:编译型只需要翻译一次,后续就不用进行翻译,解释型每次运行之前都需要翻译
编译型:c go
解释型 python shell
2 交互式和脚本方式

3 # 我是单行注释
"""我是多行注释"""

4 bool True 和 False

5 变量名应该由字母数字下划线组成
不能使用关键字
第一个字符不能是数字
6
x = 1
print(id(x))
name = "seven"
pwd = 123

inp_name = input("请输入你的用户名:")
inp_pwd = input("请输入你的密码:")
if inp_name == name and inp_pwd == pwd:
print("登录成功")
else:
print("账号密码错误")

count = 0
while count < 3:
inp_name = input("请输入你的用户名:")
inp_pwd = input("请输入你的密码")
if inp_name == name and inp_pwd == pwd:
print("登录成功")
break
else:
print("账号密码错误")
count += 1

info = [["seven", "123"], ["alex", "123"]]

count = 0
while count < 3:
inp_name = input("请输入你的用户名")
inp_pwd = input("请输入你的密码")
for line in info:
if inp_name == line[0] and inp_pwd == line[1]:
print("登陆成功")
count = 4
break
else:
print("账号密码错误")
count += 1
count = 2
x =0

while count <= 100:
if count % 2 == 0:
x += count
else:
x -= count
count += 1
print(x)

count = 0
while count <= 12:
if count == 6 or count == 10:
count += 1
continue
print(count)
count += 1

count = -1
while count < 99:
count += 2
print(count)

count = 0
while count < 100:
count += 2
print(count)

9
n1 的值给了n2 n1跟n2内存地址是一样的

import time

count = 0
while count < 3:
inp_name = input("请输入你的用户名").strip()
inp_pwd = input("请输入你的密码").strip()
with open("a.tx","r",encoding="utf-8")as f:
for line in f:
name,pwd = line.strip().split("😊
if inp_name == name and inp_pwd == pwd:
print("登录成功")
count = 4
break
else:
print("账户密码错误")
count += 1
else:
print("输错三次,锁定五分钟")
time.time(300)

posted @ 2020-07-09 22:14  刘海子  阅读(16)  评论(0编辑  收藏  举报