作业

作业一

1.简述编译型与解释型语言的区别,且分别列出你知道的哪些语言属于编译型,哪些属于解释型? 

   编译型(c)谷歌翻译

   解释型(python)同声传译        编译型执行效率高与解释型,开发效率低于解释型

2.执行 Python 脚本的两种方式是什么

交互式环境、 将代码输入文本  

3.Pyhton 单行注释和多行注释分别用什么?

单行用#  多行用“‘’”

4.布尔值分别有什么?

TURE、FALSE

5.声明变量注意事项有那些?

命名要对值有描述性、变量名不能为关键词、不能以数字开头、只能由数字下划线字母组成

6.如何查看变量在内存中的地址?

print(id(变量名))

7.写代码

1.
name=input('请输入用户名')
pwd=input('请输入密码')
if name=='seven'and pwd=='123':
print('登入成功')
else:
print('登入失败')
2.
count=0
while count<3:
name=input('请输入用户名')
pwd=input('请输入密码')
if name=='seven'and pwd=='123':
print('登入成功')
break
else:
print('用户名或密码错误')
count+=1
3.
count=0
while count<3:
name=input('请输入用户名')
pwd=input('请输入密码')
if (name=='seven'or name=='alex') and pwd=='123':
print('登入成功')
break
else:
print('用户名或密码错误')
count+=1

8.写代码

1.
res=0
count=2
while count <= 100:
if count%2 == 0:
res+=count
else:
res-=count
count+=1
print(res)
2.
count=1
while count<=12:
if count==6 :
count += 1
continue
elif count==10:
count += 1
continue
else:print(count)
count+=1
3.
count = 1
while count <= 100:
if count % 2 == 0:
print(count)
count += 1

9.

n1  is  n2  ture

n1 ==  n2  ture

作业二

1.
count = 0
while count < 2:
name = input('请输入用户名')
pwd = input('请输入密码')
if name == '大帅比' and pwd == '就是我':
print('欢迎')
break
else: print('用户名或密码错误')
count+=1
原文地址:https://www.cnblogs.com/zhanggq/p/9648834.html