Feb-21-2019, 09:43 AM
tuple("veysel",)
is same as tuple("veysel")
. When you pass str as argument to tuple()
function it returns tuple of chars:>>> tuple("veysel") ('v', 'e', 'y', 's', 'e', 'l') >>>effectively first snippet is
s=("hello",) b=s+('v', 'e', 'y', 's', 'e', 'l') print(b)In the second example, both s and a are tuples. Note that a is tuple, because of the comma at the end:
>>> a = 'veysel', >>> type(a) <class 'tuple'> >>>
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs