1

Is it possible to add different values in one input?

This is the code I have right now:

list[]
fruits = input("What are you favorite fruits? Separate each one by comma's.)
list.append(fruits)
print(list)

But the result is:

['Apple,Banana,Strawberry,Orange']




How can I make the result a different value/each single value for each fruit? Like so...

['Apple', 'Banana', 'Strawberry', 'Orange']
Edward
  • 2,291
  • 2
  • 19
  • 33
  • @Andy - Thanks Andy. I found the answer here: http://stackoverflow.com/questions/19063114/split-an-input-into-two-python-3 – Edward Sep 14 '15 at 14:31

1 Answers1

1

I found the answer after Andy posted a link to another similar question.

Split an input into two. Python 3

>>> "hello, world".split(',')
['hello', ' world']
Community
  • 1
  • 1
Edward
  • 2,291
  • 2
  • 19
  • 33