Skip to content

Commit a8c2208

Browse files
justbreakingstuffjustbreakingstuff
authored andcommitted
completed question 4
1 parent 626c54f commit a8c2208

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

Level 1/level1_question2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3
2+
13
"""
24
Question 2
35
Level 1

Level 1/level1_question3.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3
2+
13
"""
24
Question 3
35
Level 1

Level 1/level1_question4.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
Question:
5+
Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number.
6+
Suppose the following input is supplied to the program:
7+
34,67,55,33,12,98
8+
Then, the output should be:
9+
['34', '67', '55', '33', '12', '98']
10+
('34', '67', '55', '33', '12', '98')
11+
12+
Hints:
13+
In case of input data being supplied to the question, it should be assumed to be a console input.
14+
tuple() method can convert list to tuple
15+
"""
16+
17+
user_input = input('Enter a series of numbers separated by commas. (Example: 34,67,55,33,12) Your input:').split(",")
18+
# Note to future self: split() makes a list out of what would otherwise be a string...
19+
user_input_tup = tuple(user_input)
20+
21+
print(user_input, '\n', user_input_tup)

0 commit comments

Comments
 (0)