Last answered:

22 May 2023

Posted on:

11 Jan 2023

1

How is the split() method different from the a,b,c = 1,4,6 method?

It seems they are the same when assigning value to variables.

a, b, c = 1,4,6. This will assign 1,4,6 to a, b,c.
I believe you can achieve the same result by using  (a,b,c) = "1,4,6".split(',')

So what's the difference, except (a,b,c) is a tuple?

1 answers ( 0 marked as helpful)
Instructor
Posted on:

22 May 2023

0

Hi Josh!
Thanks for reaching out.


Actually, the difference is that the first one is defined as int, whereas the second one is defined as str. The quotes make the different results. You can test it with the help of the type() function.


Hope this helps.
Best,
Tsvetelin

Submit an answer