Skip to content

Code only works after resetting kernel #27

@simull

Description

@simull

Hi,

we were working on a task 3.3.3.4: of assignment 1 and produced the following code:

def my_func(element): 
    res1 = tuple(element.split('-'))
    res2 = tuple([int(i) for i in res1])
    return res2
my_func('1-11')

This is a code I also produced and it always returned an Error. However, the same code works for the others in my group. It only worked for me, when I restarted the kernel. How should I know that I have to restart the kernel and stop changing and working on the code that should already work?

I got the following Error :

TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_3364/4279762030.py in <module>
      3     res2 = tuple([int(i) for i in res1])
      4     return res2
----> 5 my_func('1-11')

~\AppData\Local\Temp/ipykernel_3364/4279762030.py in my_func(element)
      1 def my_func(element):
----> 2     res1 = tuple(element.split('-'))
      3     res2 = tuple([int(i) for i in res1])
      4     return res2
      5 my_func('1-11')

TypeError: 'tuple' object is not callable

Best,
Simon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions