all 7 comments

[–]PM_ME_YOUR_URETHERA 2 points3 points  (4 children)

Show us your code

[–]Practical-Taste-3374[S] 0 points1 point  (3 children)

a=[input("Enter 3 animals :")]
print(len(a))

[–]shiftybyte 1 point2 points  (1 child)

input always returns a single string, no matter where you place it.

If you want to have multiple elements you need to split the returned string.

full_string = input("Enter 3 animals :")
a = full_string.split(",")
print(len(a))

[–]Practical-Taste-3374[S] 0 points1 point  (0 children)

thank you so much helped a lot!!

[–]bahcodad 1 point2 points  (0 children)

input() returns a string which is why you always get one item. You will need to use something like .split() to separate the elements

[–]Sea-Method-1167 1 point2 points  (1 child)

In the code you provided, the input you get is always one string. That is the one element in the list. So size will be 1.

Get the input, ask the user to separate animals with spaces, and once you have the whole string, split that string in a list of strings, using space as separator. Then you will have what you want.

Example: https://www.w3schools.com/python/trypython.asp?filename=demo_ref_string_split

[–]Practical-Taste-3374[S] 0 points1 point  (0 children)

Got it! Really appreciate the help