Learnerslesson
   JAVA   
  SPRING  
  SPRINGBOOT  
 HIBERNATE 
  HADOOP  
   HIVE   
   ALGORITHMS   
   PYTHON   
   GO   
   KOTLIN   
   C#   
   RUBY   
   C++   




issubset( ) FUNCTION


The 'issubset( )' Function takes the values from both the Sets and checks if all the values from Set 1 is also present in Set 2.


Let us understand with the below example.


Example :


x = {"Kriti", "Sia"}
y = {"Sia", "Andrew", "Kriti"}
z = x.issubset(y)
print(z)


Output :



  True

So, in the above code we have created a 'Set' and put the names, 'Kriti' and 'Sia' to the variable 'x'.


x = {"Kriti", "Sia"}

java_Collections

Next, we have put the names, 'Sia', 'Andrew' and 'Kriti' in another set 'y'.


y = {"Sia", "Andrew", "Kriti"}

java_Collections

And used the 'issubset( )' Function next.


z = x.issubset(y)

And since, all the elements of Set 'x'(i.e. 'Kriti' and 'Sia') is also present in the Set 'y','issubset( )' returns True.


java_Collections

And we get the below output,


True