“Sets” Code-Antworten

Sets

 
DaysA = set(["Mon","Tue","Wed"])
DaysB = set(["Wed","Thu","Fri","Sat","Sun"])
AllDays = DaysA|DaysB
print(AllDays)
Yucky Yacare

Sets

// Java program Illustrating Set Interface
 
// Importing utility classes
import java.util.*;
 
// Main class
public class GFG {
   
    // Main driver method
    public static void main(String[] args)
    {
        // Demonstrating Set using HashSet
        // Declaring object of type String
        Set<String> hash_Set = new HashSet<String>();
 
        // Adding elements to the Set
        // using add() method
        hash_Set.add("Geeks");
        hash_Set.add("For");
        hash_Set.add("Geeks");
        hash_Set.add("Example");
        hash_Set.add("Set");
 
        // Printing elements of HashSet object
        System.out.println(hash_Set);
    }
}
Ill Ibis

Ähnliche Antworten wie “Sets”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen