[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Beginner] Spliting input

On 2020-06-25 2:13 PM, Bischoop wrote:
> On 2020-06-25, Andrew Bell <andrew.bell.ia at> wrote:
>> Without knowing the problem you're having, it's hard to answer.
>> This seems generally correct.
> Error track:
> Traceback (most recent call last):
>    File "", line 1, in <module>
>        numb1,numb2=input("enter 1st and 2nd no ").split()
>        ValueError: not enough values to unpack (expected 2, got 1)

Without arguments, split() splits on whitespace.

If you entered 2 numbers separated by a comma, but no spaces, there is 
no split.

Maybe you meant split(',') which will split on a comma.

Frank Millman