Python Forum
convert list compression to for loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
convert list compression to for loop
#4
The last two look right. The second looks unnecessary, could just be indices_to_delete = range(0, len(text), 250). The first one isn't right.

As general advice on question asking when it comes to programming, if you can test it yourself in a few seconds then it's not a good question to ask on a forum. Your first conversion is easy to test and verify as incorrect (even after the syntax errors are fixed), since the type isn't even right. The latter three were good questions, after the second post. As a hint on the first one, you should follow a similar pattern of the last three, creating a list and appending to it, not just doing an assignment conditionally.
Reply


Messages In This Thread
RE: convert list compression to for loop - by micseydel - Oct-09-2017, 05:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  convert set to a list type in python firaki12345 2 1,788 Feb-05-2021, 03:45 PM
Last Post: buran
  how to edit data frames and convert to a list(pandas, read_html()) ? donvirte 3 4,406 Feb-02-2018, 03:23 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020