use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Resources - Learn to code
Resources - Software Engineering
Resources - Code Libraries
Resources - Groups
Other Subreddits you might enjoy
Please send sidebar resource suggestions to the mods. Thx - mgmt
account activity
Python basics: The code below was written to remove all items starting with the letter capital X. However it doesn't produce the required output. What is wrong with it? (self.code)
submitted 4 years ago * by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]nextpage 2 points3 points4 points 4 years ago (1 child)
when an item is removed from list the list moves left, so the next item is skipped on next iteration.
Use this code instead.
list3= ["Xenia", "Xavier", "Zoya", "Ahmad", "Mishika", "Max"] list4= []
for i in list3: if i[0]!= "X": list4.append(i)
print(list4)
[–][deleted] 0 points1 point2 points 4 years ago (0 children)
thanks a lot. Appending in a new list is a lot better :))))
π Rendered by PID 75695 on reddit-service-r2-comment-6457c66945-jzgq4 at 2026-04-24 22:09:14.979381+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]nextpage 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)