Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 17 Online
OpenStudy (anonymous):

Hi! when I try to select a part of a string or tuple [eg. s = "abc", then s(0)] it throws an error and the shell tells me "string" or "tuple" objects are not callable, and if I try to select some section [eg. s(0:2)] it just throws a syntaxis error. Is something amiss with my python version?

OpenStudy (e.mccormick):

Not your puhon version. It is your syntax. functon( ) \(\leftarrow\) the ( ) is where the function call goes. string[ ] \(\leftarrow\) the [ ] is where the slice goes. ``` IDLE 2.6.5 >>> s='abc' >>> s[0] 'a' >>> ```

OpenStudy (anonymous):

thank you!

OpenStudy (e.mccormick):

np. Have fun!

OpenStudy (anonymous):

could be the older version

OpenStudy (e.mccormick):

@tibby500 What do you mean?

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!