-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path006.py
More file actions
18 lines (15 loc) · 729 Bytes
/
006.py
File metadata and controls
18 lines (15 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Write a Python program which accepts a sequence of comma-separated numbers from user and generate a list and a tuple with those numbers.
# Sample Input: 3,5,7,9
# Sample Output: List:['3','5','7','9'] # List holds comma seperated values between square brackets
# Tuple: ('3','5','7','9') # Tuple holds comma seperated values between parentheses
from typing import Tuple
values = input("Input some comma separated numbers:")
def list_generator(values):
your_list = values.split(",")
print("Your List:", your_list)
def tuple_generator(values):
your_list = values.split(",")
your_tuple = tuple(your_list)
print("Your Tuple:", your_tuple)
list_generator(values)
tuple_generator(values)