Generate a List and Tuple with User Input
- In this Python exercise, write a program that will accept a user input with numbers and generate a list and tuple with the provided input numbers.
Source code:
number_values = input("Provide a sequence of numbers separated by commas: ")list_number_values = number_values.split(",")
tuple_number_values = tuple(list_number_values)
print(f"\nThis is a printed list of the number values: ")
print(f"\t{list_number_values} ")
print("\nThis is a printed tuple of the number values: ")
print(f"\t{tuple_number_values} ")
print("""\nAt first glance you may notice the list and tuple look the same,
but the list uses brackets and the tuple uses parenthesis.""")
You write so good, everything was informative, I gained new info Keep on writing bro
ReplyDeletethank you
Delete