user_input = input()
user_list = user_input.split(",")
print(user_list)
user_tuple = tuple(user_list)
print(user_tuple)
user_input = input()
user_list = user_input.split(",")
print(user_list)
user_tuple = tuple(user_list)
print(user_tuple)
I just tried running your code and it worked perfectly for me.
Hi, I am running this code in jupyter. Does that makes any difference?
It should not. One possibility is that you have mistakenly assigned a tuple object to the tuple variable (Over-riding). Like this:
Try restarting the Jupyter Server and run the code again.
ok, thanks. Though it worked on sublime text.
yes, it worked on jupyter as well, though i did not change the code. I just restarted jupyter. can you please elaborate the error.
Did you create any variable by the name tuple
. That is the only possible scenario for this error. Because by declaring that, you have over-written the tuple class and, hence, can’t create more instances of it.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.