Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Could you teach me why this code is not running?

+1 vote
asked Aug 29, 2020 by Yungsil lee (230 points)
def show_list(slist):
    if slist.empty():
        print('The list is empty')
        return
    for i in range(slist.size()):
        print(slist.search_pos(i), end = '    ')

if __name__=="__main__":
    slist=Linked_list( )
    print("the number of data: {}".format(slist.size()))
    show_list(slist)
    print()

    slist.append(2)
    print("the number of data: {}".format(slist.size()))
    show_list(slist)
    print()

if slist.remove(2):
   print("the number of data: {}".format(slist.size()))
   show_list(slist)
   print()

1 Answer

+1 vote
answered Aug 30, 2020 by LiOS (6,420 points)
Is there additional code not included above? The Linked_list() function has not been defined - this is because the function hasn't perhaps been declared or imported.

If you can include the user defined code for Linked_list() function or include the importing of the library where Linked_list() is imported from etc, hopefully someone will be able to help.
commented Sep 2, 2020 by Yungsil lee (230 points)
I'll study and thinking base on your answer. thank you!
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...