g_list = ['Mortal Kombact', 'Contra', 'Streets of Rage', 'Shinobi', 'Sonic' 'Phatasy Star'] # For loop is used to print the list for i in g_list: print(i) # User is giving the input to remove a certain element from the list r=input("Which one do you think should be removed? ") # There is a inbuilt function in python to remove any element from the list g_list.remove(r) # New list of elements is printed after removal print("Here are the new top Sega games:") for j in g_list: print(j) M2A2 X Shinobi Sonic Phatasy Star Which one do you think should be removed? contra Traceback (most recent call last): File "C:\Users\jpala\Pycharm Projects\M2A2\M2A2.py", line 19, in g_list.remove(r) ValueError: list.remove(x): x not in list

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 8PE
icon
Related questions
Question

I keep on getting this error

 

  g_list.remove(r)
ValueError: list.remove(x): x not in list

g_list = ['Mortal Kombact', 'Contra', 'Streets of Rage', 'Shinobi', 'Sonic', 'Phatasy Star']
# For loop is used to print the list
for i in g_list:
print (i)
# User is giving the input to remove a certain element from the list
r =input("Which one do you think should be removed? ")
# There is a inbuilt function in python to remove any element from the list
g_list.remove(r)
# New list of elements is printed after removal
print("Here are the new top Sega games:")
for j in g_list:
print (j)
M2A2 X
Shinobi
Sonic
Phatasy Star
Which one do you think should be removed? contra
Traceback (most recent call last):
File "C:\Users\jpala\PycharmProjects\M2A2\M2A2.py", line 19, in <module>
g_list.remove(r)
ValueError: list.remove(x): x not in list
Transcribed Image Text:g_list = ['Mortal Kombact', 'Contra', 'Streets of Rage', 'Shinobi', 'Sonic', 'Phatasy Star'] # For loop is used to print the list for i in g_list: print (i) # User is giving the input to remove a certain element from the list r =input("Which one do you think should be removed? ") # There is a inbuilt function in python to remove any element from the list g_list.remove(r) # New list of elements is printed after removal print("Here are the new top Sega games:") for j in g_list: print (j) M2A2 X Shinobi Sonic Phatasy Star Which one do you think should be removed? contra Traceback (most recent call last): File "C:\Users\jpala\PycharmProjects\M2A2\M2A2.py", line 19, in <module> g_list.remove(r) ValueError: list.remove(x): x not in list
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Linked List Representation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr