Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 with input remove a string from the list

i cant quite figure why this code doesnt work Wall

friends = ["Kevin", "Karen", "jim", "Oscar", "Toby"]
variable = input("Delete Kevin? ")
if variable = yes:
Yoriz wrote Oct-12-2019, 09:20 AM:
Please post all code, output and errors (in it's entirety) between their respective tags. I did it for you this time, Here are instructions on how to do it yourself next time.
if variable = yes:
input returns a string, compare to a string of 'yes'
if variable = 'yes':
konsular likes this post
= 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
konsular likes this post
thanks a lot!

especialy your explanation helped my a lot buran!

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Remove from end of string up to and including some character lbtdne 2 222 May-17-2020, 09:24 AM
Last Post: menator01
  Remove escape characters / Unicode characters from string DreamingInsanity 5 267 May-15-2020, 01:37 PM
Last Post: snippsat
  Remove all \n from end of list items JackMack118 4 12,000 Dec-27-2019, 08:34 AM
Last Post: perfringo
  Highlight and remove specific string of text itsalmade 5 425 Dec-11-2019, 11:58 PM
Last Post: micseydel
  input string split Eric7Giants 3 358 Nov-13-2019, 07:19 PM
Last Post: Gribouillis
  can't remove element from a list yokaso 6 327 Nov-06-2019, 03:11 PM
Last Post: yokaso
  Help with calling list from user input farispython 5 396 Nov-03-2019, 03:13 PM
Last Post: Gribouillis
  Cannot Remove the Double Quotes on a Certain Word (String) Python BeautifulSoup soothsayerpg 5 1,289 Oct-27-2019, 09:53 AM
Last Post: newbieAuggie2019
  Input while interation in a list doug2019 6 406 Oct-06-2019, 06:44 PM
Last Post: buran
  weird result trying to remove numbers from a list Exsul 6 480 Aug-27-2019, 05:10 AM
Last Post: perfringo

Forum Jump:

Users browsing this thread: 1 Guest(s)