Python Forum

Full Version: with input remove a string from the list
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

i cant quite figure why this code doesnt work Wall

friends = ["Kevin", "Karen", "jim", "Oscar", "Toby"]
variable = input("Delete Kevin? ")
if variable = yes:
if variable = yes:
input returns a string, compare to a string of 'yes'
if variable = 'yes':
= is assignment
== is equality
You need to use the second one

then you will get another error
because at the moment yes is a variable and is not defined. You want it to be string in order to compare with the user input
thanks a lot!

especialy your explanation helped my a lot buran!