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

  • Home
  • SEARCH
  • 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 9204971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:50:22+00:00 2026-06-17T23:50:22+00:00

First, I am a novice at python programming and attempted much research within other

  • 0

First, I am a novice at python programming and attempted much research within other questions but none that I could find that relate to something like this (all others were a bit more advanced) — That said moving on.

The solution needed:
Go through two two integer lists and compare for equality. Ideally I want it to continue going through the lists over and over till there is an equality (more on this after showing code). The number will be generated in list2 over and over till there is an equality.

Explanation to code: I have two lists that are generated via a random number generation. The lists are not equal in size. So list1 has 500 entries and list2 will have different amounts varying from 1 to 100.

#current attempt to figure out the comparison. 
if (list1 = list2):
     print(equalNumber)

Maybe I do not know much about looping, but I want it to loop through the list, I really do not know where to start from. Maybe I’m not using a loop like a for loop or while?

This is my number generators:

    for i in range(0,500):
          randoms = random.randint(0,1000)
          fiveHundredLoop.append(randoms)

The second one would do some but would only have varying entries between 1 and 100. {I can take care of this myself}

  • 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-17T23:50:23+00:00Added an answer on June 17, 2026 at 11:50 pm

    There are several possible interpretations of your question.

    1) Loop over the lists pairwise, stopping when a pair is equal:

    >>> s = [10, 14, 18, 20, 25]
    >>> t = [55, 42, 18, 12, 4]
    >>> for x, y in zip(s, t):
            if x == y:
                print 'Equal element found:', x
                break
    
    
    Equal element found: 18
    

    2) Loop over a list, stopping when any element is equal to any other element in the first list. This is a case where sets are useful (they do fast membership testing):

    >>> s = {18, 20, 25, 14, 10}
    >>> for x in t:
            if x in s:
                print 'Equal element found', x
                break
    
    
    Equal element found 18
    

    3) Loop over both like element-wise and compare their values:

    >>> s = [10, 14, 18, 20, 25]
    >>> t = [55, 42, 18, 12, 4]
    >>> [x==y for x, y in zip(s, t)]
    [False, False, True, False, False]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions. First, how can I find out what Python modules (and
So first let me say that I am a novice at Python and functions
I would first like to admit that I am an extremely novice developer, so
I am a novice to Python and have started to write my first module
Below is python code that attempts to find the sum of all values divided
Hello Friend, I am novice in Python. I saw an instruction in Python programming
This is my first question that I haven't been able to find an answer
As a C# Novice, currently to find out the index of the first uppercase
I know that it isn't first topic when somebody considering different GUI libraries. But
I'm a rails novice and just finished my first rails app(as far as I

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.