tuple from list

We can “freeze lists” by turning them into tuples:
greetings = ['Hi', 'Hello', 'Hey']
greetings = tuple(greetings)
print(greetings)     # ('Hi', 'Hello', 'Hey')
Note that the output of this code is ('Hi', 'Hello', 'Hey') indicating that the variable greetings is of type tuple.
We will cover tuples again when we start writing functions.

Challenge

Given n names in the input, create a tuple called names and print the resulting tuple in the output.
The first line of the input contains a single integer n. The next n lines contain names each on a separate line.
The program should print a single line - the resulting tuple.
Input
Output
5 Anna Bella Lucy Stella Susan
('Anna', 'Bella', 'Lucy', 'Stella', 'Susan')
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue