![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python面试题
苍狼搏鹰
人生来注定要走向死亡,但谁曾放弃过呢?
展开
-
Python基础面试题:让用户输入用户名密码,成功打印欢迎信息,输错提示还剩几次机会,三次机会仍然错误推出程序,请代码实现?
#encoding=“utf-8”user = “luocq”password = “12345678”count = 0for i in range(3):username = input(“username:”)password = input(“password:”)if username == user and password == password:print(“Welcome Login”)count = 3breakelse:print(“Wrong username原创 2020-09-19 20:12:02 · 1081 阅读 · 1 评论 -
python基础面试题:python 列表 a=[1,2,3,4,5,6,7,8,9,10],将列表a的值赋值给列表b,在不影响列表a的情况下,将列表b的值每间隔一个元素替换成6,请写代码实现?
#encoding=“utf-8”a=[1,2,3,4,5,6,7,8,9,10]b=[]for i in a:if i%2==0:j=6b.append(j)else:j=ib.append(j)print(b)运行效果截图:原创 2020-09-19 20:06:52 · 8009 阅读 · 1 评论