鱼C论坛

 找回密码
 立即注册
楼主: WangJS

[已解决]小白Python练习册(4)【鱼币福利】

[复制链接]
发表于 2020-12-3 09:05:21 | 显示全部楼层
学习
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-12-3 14:50:53 | 显示全部楼层
current_users = ['admin','Jason','Peter','WangJS','Good']
new_users = ['Jason','隔壁老王','wangjs','蔓越莓','Peter']
new = new_users[:]
current = current_users[:]

for i in range(len(current_users)):
    current[i] = current_users[i].lower()
    new[i] = new_users[i].lower()

for i in range(len(current_users)):
    if new[i] in current:
        print(new_users[i] + "已被使用")
    else:
        print(new_users[i] + "未被使用")
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-9-12 15:31:34 | 显示全部楼层
111
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-9-16 16:45:14 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-12-1 19:00:41 | 显示全部楼层
  1. current_users = ['admin','Jason','Peter','WangJS','Good']
  2. new_users = ['Jason','隔壁老王','wangjs','蔓越莓','Peter']

  3. for i in new_users:
  4.     if i in current_users:
  5.         print(i,'已被使用')
  6.     else:
  7.         print(i,'没被使用')
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2023-3-28 22:19:59 | 显示全部楼层
current_users = ['admin','Jason','Peter','WangJS','Good']
new_users = ['Jason','隔壁老王','wangjs','蔓越莓','Peter']
current=current_users[:]
new=new_users[:]
for i in range(len(current)):
    current[i]=current_users[i].lower()
    new[i]=new_users[i].lower()
print(new)
print(current)
for j in range(len(new_users)):
    for i in range(len(current_users)):
       if new[j]==current[i]:
           print(new_users[j],'已被使用')
           break
       if i==len(current_users)-1:
          print(new_users[j],'未被使用')
       i+=1
    j+=1
        
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2023-3-29 14:46:43 | 显示全部楼层
66666
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-20 02:39

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表