defaverage(array): distinct =set(array)returnsum(distinct)/len(distinct)if__name__=='__main__': n =int(input()) arr =list(map(int, input().split())) result =average(arr)print(result)
n =int(input())english_newspaper =set(map(int, input().split()))m =int(input())french_newspaper =set(map(int, input().split()))print(len(english_newspaper.union(french_newspaper)))
Set .intersection() Operation
n =int(input())english_newspaper =set(map(int, input().split()))m =int(input())french_newspaper =set(map(int, input().split()))print(len(english_newspaper.intersection(french_newspaper)))
Set .difference() Operation
n =int(input())english_newspaper =set(map(int, input().split()))m =int(input())french_newspaper =set(map(int, input().split()))print(len(english_newspaper.difference(french_newspaper)))
Set .symmetric_difference() Operation
n =int(input())english_newspaper =set(map(int, input().split()))m =int(input())french_newspaper =set(map(int, input().split()))print(len(english_newspaper.symmetric_difference(french_newspaper)))
Symmetric Difference
m =int(input())M =set(map(int, input().split()))n =int(input())N =set(map(int, input().split()))for each insorted(M.symmetric_difference(N)):print(each)
K =int(input())room_numbers =list(map(int, input().split()))distinct_room_numbers =set(room_numbers)for each in distinct_room_numbers: room_numbers.remove(each)print(distinct_room_numbers.difference(set(room_numbers)).pop())
Check Subset
for _ inrange(int(input())): a =int(input()) A =set(map(int, input().split())) b =int(input()) B =set(map(int, input().split()))if A.issubset(B):print(True)else:print(False)
Check Strict Superset
A =set(map(int, input().split()))for _ inrange(int(input())):if A.issuperset(set(map(int, input().split()))):passelse:print(False)exit()print(True)
No Idea!
happiness =0n, m =map(int, input().split())arr =list(map(int, input().split()))A =set(map(int, input().split()))B =set(map(int, input().split()))for each in arr:if each in A: happiness +=1if each in B: happiness -=1print(happiness)