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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:09:29+00:00 2026-05-17T17:09:29+00:00

I have a problem. I want to make a dictionary that translates english words

  • 0

I have a problem. I want to make a dictionary that translates english words to estonian. I started, but don’t know how to continue. Please, help.
Dictionary is a text document where tab separates english and estonian words.

file = open("dictionary.txt","r")

eng = []

est = []

while True :
    lines = file.readline()

    if lines == "" :
        break

    pair = lines.split("\t")
    eng.append(pair[0])
    est.append(pair[1])

    for i in range......

Please, help.

  • 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-17T17:09:30+00:00Added an answer on May 17, 2026 at 5:09 pm

    For a dictionary, you should use the dictionary type which maps keys to values and is much more efficient for lookups. I also made some other changes to your code, keep them if you wish:

    engToEstDict = {}
    
    # The with statement automatically closes the file afterwards. Furthermore, one shouldn't
    # overwrite builtin names like "file", "dict" and so on (even though it's possible).
    with open("dictionary.txt", "r") as f:
        for line in f:
            if not line:
                break
    
            # Map the Estonian to the English word in the dictionary-typed variable
            pair = lines.split("\t")
            engToEstDict[pair[0]] = pair[1]
    
    # Then, lookup of Estonian words is simple
    print engToEstDict["hello"] # should probably print "tere", says Google Translator
    

    Mind that the reverse lookup (Estonian to English) is not so easy. If you need that, too, you might be better off creating a second dictionary variable with the reversed key-value mapping (estToEngDict[pair[1]] = pair[0]) because lookup will be a lot faster than your list-based approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to place UItextField in UITableViewCell but I have problem. Text field don't
I want to make multiple editing page. But I don't know how to use
i have developed ads website but i have problem, i want make period from
i want to make a Real Time Trading App.. but i have a problem
I have 3 panels and I want to make drags on them. The problem
I have problem with fancybox. I want to write a function that will run
I want to have a dictionary that assigns a value to a set of
I'm trying to make an English-Hebrew Dictionary. I have a dictionary in Tab format
I have a problem I want to make a jquery submenu like this: <ul
I have a problem, I want insert data with a button click method, but

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.