Hello Programmers/Coders, Today we are going to share solutions of Programming problems of HackerRank of Programming Language Python. At Each Problem with Successful submission with all Test Cases Passed, you will get an score or marks. And after solving maximum problems, you will be getting stars. This will highlight your profile to the recruiters.
In this post, you will find the solution for Check Subset in Python-HackerRank Problem. We are providing the correct and tested solutions of coding problems present on HackerRank. If you are not able to solve any problem, then you can take help from our Blog/website.
Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.
Introduction To Python
Python is a widely-used, interpreted, object-oriented, and high-level programming language with dynamic semantics, used for general-purpose programming. It was created by Guido van Rossum, and first released on February 20, 1991.
Python is a computer programming language often used to build websites and software, automate tasks, and conduct data analysis. It is also used to create various machine learning algorithm, and helps in Artificial Intelligence. Python is a general purpose language, meaning it can be used to create a variety of different programs and isn’t specialized for any specific problems. This versatility, along with its beginner-friendliness, has made it one of the most-used programming languages today. A survey conducted by industry analyst firm RedMonk found that it was the most popular programming language among developers in 2020.
Link for the Problem – Check Subset in python – HackerRank Solution
Check Subset in python – HackerRank Solution
Problem:
You are given two sets, and .
Your job is to find whether set is a subset of set .
If set is subset of set , print True.
If set is not a subset of set , print False.
Input Format
The first line will contain the number of test cases, .
The first line of each test case contains the number of elements in set .
The second line of each test case contains the space separated elements of set .
The third line of each test case contains the number of elements in set .
The fourth line of each test case contains the space separated elements of set .
Constraints
Output Format
Output True or False for each test case on separate lines.
Sample Input
3 5 1 2 3 5 6 9 9 8 5 6 3 2 1 4 7 1 2 5 3 6 5 4 1 7 1 2 3 5 6 8 9 3 9 8 2
Sample Output
True False False
Explanation
Test Case 01 Explanation
Set = {1 2 3 5 6}
Set = {9 8 5 6 3 2 1 4 7}
All the elements of set are elements of set .
Hence, set is a subset of set .
Check Subset in python – HackerRank Solution
# Check Subset in python - Hacker Rank Solution # Python 3 # Enter your code here. Read input from STDIN. Print output to STDOUT # Check Subset in python - Hacker Rank Solution START T = int(input()) for _ in range(T): a = input() A = set(input().split()) b = int(input()) B = set(input().split()) print(A.issubset(B)) # Check Subset in python - Hacker Rank Solution END