Hey all, My class is trying to write a python script to do our seating assignments. I keep gaining a ValueError once I run this portion of my manuscript and I do not understand also why. Would someone have the ability to assist me out?

This is the percent I am having actually problems with: grad = <'AN', 'MG', 'CG', 'AJ', 'KJ', 'SP', 'SPaine', 'KS'>

under = <'EB', 'KB', 'AC', 'ND', 'RG', 'MK', 'SR', 'BS', 'EZ'>

list1 = <>

list2 = <>

list3 = <>

list4 = <>

list5 = <>

import random

G = random.choices((grad), k = 2)

list1.append(G)

U = random.choices((under), k = 2)

list1.append(U)

print(list1)

grad.remove(G)

under.remove(U)

The problem lies through the grad.remove(G) and the under.remove(U). I execute not understand also why it is throwing this error.

You are watching: List.remove(x): x not in list


10 comments
share
save
hide
report
100% Upvoted
This thcheck out is archived
New comments cannot be posted and votes cannot be cast
Sort by: best


*

level 1
· 4y
Publish out G and also U. I think they are lists and also not strrings so : ("hi") does not equal (<"hi">). Check that out and also let me know.


3
Share
ReportSave
level 2
Op · 4y

I believe it returns them as lists. Here is what it returns via the rerelocate commands commented out.

See more: Watch Game Of Thrones Season 8 Episode 5 Putlockers, Game Of Thrones Season 8 Episode 5

<<'KJ', 'KJ'>, <'AC', 'AC'>>

<'KJ', 'KJ'>

<'AC', 'AC'>


1
Share
ReportSave
Continue this thread 


More short articles from the learnpython community
Continue browsing in r/learnpython

*

r/learnpython
Subtastecraftedmcd.com for posting concerns and asking for basic advice around your python code.
555k
Members


719

Online


Created Oct 2, 2009
Join
*
*
*
*

*

Top write-ups february 28th 2018Top write-ups of february, 2018Top write-ups 2018
helptastecraftedmcd.com coinstastecraftedmcd.com premiumtastecraftedmcd.com gifts
aboutcareerspressadvertiseblogTermsContent policyPrivacy policyMod policy
Back to Top