PATpython练习题帅到没朋友

编程入门 行业动态 更新时间:2024-10-26 23:39:26

PATpython<a href=https://www.elefans.com/category/jswz/34/1768594.html style=练习题帅到没朋友"/>

PATpython练习题帅到没朋友

输入样例1

3
3 11111 22222 55555
2 33333 44444
4 55555 66666 99999 77777
8
55555 44444 10000 88888 22222 11111 23333 88888

输出样例1

10000 88888 23333

输入样例2

3
3 11111 22222 55555
2 33333 44444
4 55555 66666 99999 77777
4
55555 44444 22222 11111

输出样例2

No one is handsome
amount = int(input())
#找出有朋友的人来
friends = set()
for i in range(amount):line = input().split()#朋友圈只有自己相当于没朋友if(line[0] == "1"):passelse:for people in line[1:]:friends.add(people)#print(friends)
amountOfsearch = int(input())
#存储已经查找过的人
people_searched = set()
#没有朋友的人
no_friends_list = []
#需要查找的人
want_to_search = input().split(" ")
for people in want_to_search:#如果没朋友而且没有查找过存放在结果列表中if(people not in friends and people not in people_searched):people_searched.add(people)no_friends_list.append(people)if(len(no_friends_list) == 0):print("No one is handsome")
else:print(" ".join(no_friends_list))

更多推荐

PATpython练习题帅到没朋友

本文发布于:2023-07-28 20:25:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1300357.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:练习题   朋友   PATpython   帅到没

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!