File tree 3 files changed +12
-12
lines changed
Advanced/1.Stacks, Queues, Tuples and Sets/Tuples and Sets - Exercise
3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 2
2
3
3
unique_usernames = {input () for username in range (names )}
4
4
5
- [ print (username ) for username in unique_usernames ]
5
+ print (' \n ' . join ( unique_usernames ))
6
6
7
7
8
8
# print('\n'.join({input() for username in range(int(input()))}))
Original file line number Diff line number Diff line change 1
- lines_with_elements = int (input ())
1
+ lines = int (input ())
2
2
3
- unique_elements = set ()
3
+ periodic_table = set ()
4
4
5
- for elements in range (lines_with_elements ):
5
+ for element in range (lines ):
6
6
chemical_elements = input ().split ()
7
- [unique_elements .add (elem ) for elem in chemical_elements ]
7
+ [periodic_table .add (elem ) for elem in chemical_elements ]
8
8
9
- print ('\n ' .join ([ element for element in unique_elements ] ))
9
+ print ('\n ' .join (periodic_table ))
Original file line number Diff line number Diff line change 1
- symbols = tuple ( sorted ([ char for char in input ()])) # makes a tuple containing of every single character
1
+ lines = int ( input ())
2
2
3
- counted_characters = [] # checks if a character is already counted
3
+ periodic_table = set ()
4
4
5
- for symbol in symbols :
5
+ for element in range (lines ):
6
+ chemical_elements = input ().split ()
7
+ [periodic_table .add (elem ) for elem in chemical_elements ]
6
8
7
- if symbol not in counted_characters :
8
- print (f"{ symbol } : { symbols .count (symbol )} time/s" )
9
- counted_characters .append (symbol )
9
+ print ('\n ' .join (periodic_table ))
You can’t perform that action at this time.
0 commit comments