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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:07:50+00:00 2026-05-21T09:07:50+00:00

I have a code aaabbbcccdddeee that I split up into 3 letter words (such

  • 0

I have a code "aaabbbcccdddeee" that I split up into 3 letter words (such as 'aaa','bbb','ccc' . . . and so on) and assigned a number value to them using d=dict(zip(('aaa','bbb','ccc','ddd','eee'),(123,234,345,456,567)))

If I have a random sequence of 3 letter words

RANDOM="'aaa','bbb','ddd','ccc','eee','ddd','bbb','aaa','eee','ccc'"

How can I create a list that converts the RANDOM list into a list composed of the number values that were assigned previously in the dictionary

Example: RANDOM="'aaa','bbb','ddd','ccc','eee','ddd','bbb','aaa','eee','ccc'"‘ to produce '123','234','456','345','567','456','234','123','567','345'

I found out how to do it for 1 value:

>>> x=d['aaa']

>>> print x

>>> 123

How do I do it for the whole list of RANDOM?
It does not work if i simply put:

>>> y=d['aaa','bbb','ddd','ccc',...]

Does anyone know why this won’t work or how to get it to work to get the full list of numbers . i.e. 123,234,456,345,…?

I have been messing with this on and off for a few weeks. It’s not homework if your wondering, but this can help me with my studies in other areas. Any help would be greatly appreciated!

  • 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-21T09:07:50+00:00Added an answer on May 21, 2026 at 9:07 am

    y=d[‘aaa’,’bbb’,’ddd’,’ccc’,…]
    won’t work because ‘aaa’,’bbb’,’ddd’,’ccc’ is not a valid key. The y = d[ … ] looks up a SINGLE key value, and returns the SINGLE matching entry for that key in the dictionary.

    So, you just need to translate each entry one at a time.

    y=d[‘aaa’]

    x=d[‘bbb’]

    z=d[‘ccc’]

    and then a = [y, x, z] … etc.

    or, being more intelligent, we can use a loop that loops based on the length of the RANDOM list.

    a = list()

    for x in RANDOM:

    a.append(d[x])

    or, to be fancy

    a = [d[x] for x in RANDOM]

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

Sidebar

Related Questions

I have code that generates a random number form 0-1 3 times and I
I have code that pics a random number from 0 to 1. I am
I have code that references a web service, and I'd like the address of
I have code that looks like the following, which works fine for displaying the
i have code that calls a broadcast receiver, in the receiver, i try to
I have code that's somewhat like this: ($i=0; $i < 100; $i++) { do
I have code that works great in the emulator but on a 3gs device
I have code coverage in XCode 4.2 with libprofile_rt working. I have noticed that
I have code <a href=javascript:someFunction(this); tabindex=0>Some text</a> Is it possible to pass element into
I have code that gets a div contents: include_once('simple_html_dom.php'); $html = file_get_html(link); $ret =

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.