Reputation: 3
So I'm revising my code and I'm wishing I could highlight just the part where I made a mistake so it would be easy to spot the mistake if I come back to it and learn from it....
#Don't Need True When Using In
gifts = []
l = input ("What do you want to have?")
gifts.append(l)
while l.lower() != "nothing" :
l = input ("Anything else?").lower()
gifts.append(l)
a = gifts.index("nothing")
gifts = gifts[:a] + gifts[a+1:]
if "soup" in gifts ==True:
b = gifts.index('soup')
gifts = gifts[:b]+["broth"]+gifts[b+1:]
for x in gifts:
print ("I can give you", end= " ")
print (x, end = " ")
print ("if you wish..")
I trapped it in a triple quote to preserve it so everything is green right now. Can I make just the (if "soup" in gifts == True:) part a different color somehow?
Upvotes: 0
Views: 286
Reputation: 173
From what i know you can't, but another solution would be to write
a
# TODO - fix stuff on the left --------------------------------
comment on the right side of this line
Upvotes: 1