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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:21:55+00:00 2026-06-05T01:21:55+00:00

Ok, I have a dictionary called food. food has two elements, both of which

  • 0

Ok, I have a dictionary called food. food has two elements, both of which are dictionaries themselves, veg and dairy. veg has two elements root : Turnip, and stem : Asparagus. dairy has cheese : Cheddar and yogurt : Strawberry. I also have a new dictionary fruit which has red : Cherry and yellow : Banana.

food['veg']['root'] == 'Turnip'
food['dairy']['cheese'] == 'Cheddar' 

etc and

fruit['red'] == 'Cherry'

Now I would like to add the “fruit” dictionary to the “food” dictionary in its entirety, so that I will have:

food['fruit']['red'] == 'Cherry'

I know that I could do something like this:

food['fruit'] = fruit

But that seems clumsy. I would like to do something like

food.Append(fruit)

But that doesn’t do what I need.

(Edited to removed the initial capitals from variable names, since that seemed to be causing a distraction.)

  • 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-05T01:21:56+00:00Added an answer on June 5, 2026 at 1:21 am

    Food['Fruit'] = Fruit is the right and proper way (apart from the capitalized names).

    As @kindall wisely notes in the comment, there can be several names referencing the same dictionary, which is why one can’t build a function that maps the object to its name and uses that as the new key in your food dict.

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

Sidebar

Related Questions

I have a simple but huge table called 'dictionary' which has 2 columns. Id
I have an interface called Dictionary which has a method insert() . This interface
I have a simple iOS app in which one class called Dictionary (.m and
I have a dictionary table called car_status that has an 'id' column and a
I have a class called Root which serves as some kind of phonebook for
Say I have a Dictionary object which contains many instances of an object called
I have a dictionary called fsdata at module level (like a global variable). The
I have a Dictionary called AvailableBoxes. I want to lookup a string in this
I have a list of Google Maps API markers in a dictionary called markerList
I have a Dictionary where the key and value are both strings. It's possible

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.