Checking Subset in Python

Author: Al-mamun Sarkar Date: 2020-03-24 18:13:29

Checking if a set is a subset of another set in python. The following code shows how to find a subset on set in python. This is the solution of the HackerRank Check Subset Python Sets problem.

Code:


T = int( input() )
for x in range(0,T):
	n = int(input())
	A = set(input().split())
	m = int(input())
	B = set(input().split())
	
	if len(A.difference(B)):
		print('False')
	else:
		print('True')