Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4586724
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:40:45+00:00 2026-05-21T21:40:45+00:00

Consider the lists below filters= [u, i, g, r, z] result = [None, 34,

  • 0

Consider the lists below

filters= [u,    i,  g,    r,    z]
result = [None, 34, None, None, 45]

the items in the result are computed for each filter in filters. It happens that filters, u, g, z did not return any results. So i would to re-compute the values of result[0], result[2], result[4], using the filters that returned values.

My problem is iterating through both lists and using the closet filter to compute a value missing in result.
e.g result[0] should be computed using 'i' (i is closest to u) result[2] we also use 'i' not 'z' and result[3] we use 'z'. How to generalize this?? (filters are fixed, but items in values keep changing.) What i would like to get is a tuple with two filters, (filter_missing_a_value_in_results, filter_to_used_to_computer_the_missing_value)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:40:46+00:00Added an answer on May 21, 2026 at 9:40 pm

    Not particularly efficient solution:

    def filters_by_distance(i):
        '''Generate filters by distance from i'''
        sorted_indices = sorted(range(len(filters)), key=lambda j: abs(j-i))
        return (filters[j] for j in sorted_indices)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please consider my codes below: I'm getting an error Constructor on type 'System.String' not
Consider the code below (which has been simplified). I have a service class that
Consider the class below that represents a Broker: public class Broker { public string
Consider the current algorithm below that iterates through a GridView 's rows to find
consider the code below, Am trying to make a Sparse_matrix that contains an array
This question relates to recursion. Consider the program shown below (not my real code,
Consider the code below $('.item_select').each(List); function List() { var x= this.siblings('.fooClass'); } When I
Consider following scenario: I have RESTful URL /articles that returns list of articles user
I consider refactoring few method signatures that currently take parameter of type List or
Consider this code: public <T> List<T> meth(List<?> type) { System.out.println(type); // 1 return new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.