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 8328865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:34:40+00:00 2026-06-09T01:34:40+00:00

for i, e in enumerate(l1): if (e[0] == e[1]) and ((e[0], e[1]) not in

  • 0
for i, e in enumerate(l1):
    if (e[0] == e[1]) and ((e[0], e[1]) not in l1):
        raise ValueError, '%s is missing' %(e[0], e[1])

    if i!=len(l1)-1:
        if e[0]==l1[i+1][0] and e[1]!=l1[i+1][1]-1:
            raise ValueError, '(%s,%s) is missing ' %(e[0], e[1]+1)

l1 = [(1, 2), (1, 3), (1, 4), (2, 1), (2, 3)]

I am able to work for missing (1,2) and (2,2) but in the above case first it should look for (1,1) to report an error if it’s not there however in the above code it goes undetected. Likewise it should traverse the whole list to check if any thing is missing. also what if I want (2,4) and its missing in l1. There should be a error been reported here as well

  • 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-06-09T01:34:41+00:00Added an answer on June 9, 2026 at 1:34 am

    I’m ignoring your other question as you would simply need to check whether the front letters are the same.

    EDIT: Apparently I missed some. New solution that is horribly inefficient and kind of ugly:

    missing = []
    num = {}
    for i,e in enumerate(l1):
        if not e[0] in num:                # first number groups
            num[e[0]] = []                 # make a list of them (empty... for now)
            for z,q in enumerate(l1):      # for all of the numbers
                if q[0]==e[0]:             # that are in the first number group
                    num[e[0]].append(q[1]) # append 
                                           # then start again with second number group
    
    for i in num.keys():                            # for each number group
        for e in xrange(min(num[i]),max(num[i])+1): # from minimum to maximum, iterate
            if not e in num[i]:                     # if any number isn't there
                missing.append((i,e))               # make note
    
    print missing # [(1, 3), (2, 3), (2, 4), (3, 2)]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to enumerate sections in latex not just to show 1/2/3 but
I am able to enumerate all plugged smartcard devices on any machine. I can
I was wondering if it would be possible to enumerate returned rows. Not according
Hopefully I'm not missing something obvious... I'm creating a function that will ease in
This may not be considered to be directly programming related but I am at
Can you fast enumerate a NSIndexSet ? if not, what's the best way to
I do not need char in this example, but I include it to get
I'm not certain how to word the question but hopefully my description will make
I tring to use a dropdownbox using a Bson object(BsonDevise) but is not clear
How can you enumerate an enum in C#? E.g. the following code does not

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.