4 Réponses
+ 1
user = input('Enter the string:')
store = list(user)
print(store)
0
user_name = list(input("Enter the string: "))
print(user_name)
0
It depends on how you enter the data. If the data in the input is separated by spaces, you can use input().split(). If it is separated by commas, you can use input().split(","), etc.
For example:
nums = input()
#user input: "1,2,3,4,5"
list_nums = nums.split(",")
print(list_nums)
#gives: ["1", "2", "3", "4", "5"]
words = input()
#user input: "these are some words"
list_words = words.split()
print(list_words)
#gives: ["these", "are", "some", "words"]
0
★«D.Connect_Zone» Dilji That doesn't quite work as it will split the string into a list of individual characters.