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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:08:34+00:00 2026-06-13T01:08:34+00:00

I have a series of puzzles: Strings of morse code with no spaces between

  • 0

I have a series of puzzles: Strings of morse code with no spaces between the letters or words. My plan is to do a dictionary attack to find the best solution candidates. My weapon is Python.

I have a list of 17000 English words. I also have a much smaller list of words that are pertinent to the puzzle’s theme, and if those words show up they should score higher.

So at the very beginning of my script when I generate the list of words, I use a list of tuples of the form (word, scoremultiplier). Here’s a small subset:

[('zoned', 1.0), 
 ('zonely', 1.0), 
 ('zoner', 1.0), 
 ('zones', 1.0), 
 ('zoning', 1.0), 
 ('zoo', 1.0), 
 ('zoom', 1.0), 
 ('zoomed', 1.0), 
 ('zooming', 1.0), 
 ('zooms', 1.0), 
 ('zoos', 1.0), 
 ('ten', 1.0), 
 ('tens', 1.0), 
 ('gnash', 1.0), 
 ('shag', 1.0), 
 ('75th', 2.0), 
 ('seventy', 2.0), 
 ('fifth', 2.0)]

In the file that I parse all that out of, I want to just stick the high-value words at the end, without manually getting rid of any duplicates in the main part of the file. So I need to write something to get rid of the early tuples whose first value is equal to that of a later tuple.

I can do this with brute force:

for firstkey, (firstword, firstfactor) in enumerate(wordlist):
    for laterkey, (laterword, laterfactor) in enumerate(wordlist[firstkey+1:]):
        if firstword == laterword:
            del wordlist[firstkey]
            break

But that part of the script alone takes almost 45 seconds, and my 17000 words isn’t even a full dictionary. (That code is also untested other than the time it takes to finish, so it may not even work.) It also seems very un-Pythony, though I’m just now learning Python (and doing some of my first programming at all) with this very project.

Is there a better way to do this? I can’t use set() because the duplicate words are part of nonequal tuples. Do I need to restructure my data somehow? Or should I just be prepared to wait a full minute every time I run this?

  • 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-13T01:08:35+00:00Added an answer on June 13, 2026 at 1:08 am

    I might be misunderstanding the question, but it looks like you can generate a dict from the list of tuples. Later values will automatically overwrite earlier ones:

    lst = [
        ('foo', 1),
        ('bar', 2),
        ('foo', 10)
    ]
    
    print dict(lst) # {'foo': 10, 'bar': 2}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a series of strings and their replacements separated by spaces: a123 b312
I have a series of strings (URLs) in different forms as: http://domain name.anything/anypath https://dmain
I have a series of words animating, using css3. A background image of the
I have time series data that I am currently storing in a dictionary where
I have a series like 1,2,199,100,8,100,199,1001,5,9 and I got to write a pseudo code
I have a series of images lined up using the following code. HTML for
I have series of images for animation, say Image 1 to 1000. I plan
I have a series of strings, which are two numbers: 1.782-100.799 -18.107-102.016 -17.504104.059 How
I have a series of PHP page, and I would like to use conditional
I have a series of if statements in a function like this: if time

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.