Problem

1/10

Sets. How to create?

Theory Click to read/hide

Sets

In mathematics, there is such a thing as a set (or set theory). Perhaps you even studied them in a math course. You may even be familiar with Venn diagrams.
In practice, a set can be thought of simply as a well-defined set of individual objects, called elements or members.
Grouping objects into a set can be useful in programming, and Python provides us with the built-in type set.

Sets (type set) differ from other types of objects in the unique operations that can be performed on them.

The built-in type set in Python has the following characteristics:
    The
  • elements of a set are unordered (meaning that two sets are equivalent if they contain the same elements). The elements of the set are stored not sequentially, but according to certain algorithms that allow you to quickly determine whether an element belongs to a set (without enumeration of all elements);
  • set elements are unique. Duplicate elements are not allowed;
  • sets are mutable (for example, you can add an element to a set), but the elements themselves inside the set must be immutable (numbers, strings, tuples). You cannot make a list or another set an element of a set;

 

Create set
1 way

Simply enumerate in curly braces the elements in the set.

x = {"school", "teacher", "class", student}
 

2 way 
Use the built-in function set(). x = set()    # empty set list_name = ["Andry", "Bob", "Caroline"] y = set(list_name)    # you can create multiple                        # from any iterable object z = set(["Andry", "Bob", "Caroline"])     # {'Bob', 'Caroline', 'Andry'} k = set(("Andry", "Bob", "Caroline"))     # {'Bob', 'Caroline', 'Andry'} s = "string s" m = set(s)    # {'i', 't', 'g', 'r', 'n', & #39;s', ' '} -                # Pay attention!                # the order of the elements can be any,               # elements are not repeated n = {42, 'foo', 3.14159, None, (1, 2, 3)}    # elements in                                                # can be of different types  
Set output
The elements of the set are displayed in an arbitrary order, not necessarily in the order in which they are added. z = set(["Andry", "Bob", "Caroline"])  print(z)     # {'Bob', 'Caroline', 'Andry'} print(*z)    # Bob Andry Caroline

Problem

Deniska likes to brag about his skills to Mishka. Now he decided to brag about the fact that he remembers any sequence of numbers and can accurately name the numbers that occur in it. Mishka decided to confuse Deniska and began to name a large number of the most diverse numbers. Help Deniska not to fall into the mud in front of a friend, write a program that would output without repetition all the numbers that Mishka came up with.

Input
The input is a sequence of numbers.

Imprint
Display all the numbers that appear in it once on the screen. 

Examples
# Input Output
1 4 5 7 2 3 3 2  2 3 4 5 7