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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:59:58+00:00 2026-06-14T21:59:58+00:00

I need help on a problem. For example I have the following dictionary named

  • 0

I need help on a problem. For example I have the following dictionary named planets:

{'Mercury': {'Orbital Radius': '38001200', 'Radius': '243900.7',
'Period': '87.9691'}, 'Ariel': {'Orbital Radius': '8595000', 'Radius':
'60000', 'Period': '2.520379'}, 'Sun': {'Satellites':
'Mercury,Venus,Earth,Mars,Jupiter,Saturn,Uranus,Neptune,Ceres,Pluto,Haumea,Makemake,Eris',
'Orbital Radius': '0', 'Radius': '20890260'}, 'Phobos': {'Orbital
Radius': '3623500.6', 'Radius': '200000', 'Period': '0.31891023'},
'Deimos': {'Orbital Radius': '8346000', 'Radius': '200000.2',
'Period': '1.26244'}, 'Mars': {'Satellites': 'Phobos,Deimos', 'Orbital
Radius': '106669000', 'Radius': '339600.2', 'Period': '686.971'},
'Rhea': {'Orbital Radius': '24000000', 'Radius': '75000', 'Period':
'4.5'}, 'Oberon': {'Orbital Radius': '26235000', 'Radius': '75000',
'Period': '13.463'}, 'Europa': {'Orbital Radius': '36486200',
'Radius': '156000.8', 'Period': '3.551181'}, 'Tethys': {'Orbital
Radius': '13706000', 'Radius': '50000', 'Period': '1.9'}, 'Miranda':
{'Orbital Radius': '5822550', 'Radius': '23500', 'Period': '1.413'},
'Saturn': {'Satellites':
'Mimas,Enceladus,Tethys,Dione,Rhea,Titan,Iapetus', 'Orbital Radius':
'353572956', 'Radius': '6026800', 'Period': '10759.22'}, 'Uranus':
{'Satellites': 'Puck,Miranda,Ariel,Umbriel,Titania,Oberon', 'Orbital
Radius': '453572956', 'Radius': '2555900', 'Period': '30799'},
'Neptune': {'Satellites': 'Triton', 'Orbital Radius': '550000000',
'Radius': '2476400', 'Period': '60190'}, 'Titania': {'Orbital Radius':
'19575000', 'Radius': '75000', 'Period': '8.7058'}, 'Enceladus':
{'Orbital Radius': '10706000', 'Radius': '25000', 'Period': '1.4'},
'Venus': {'Orbital Radius': '57477000', 'Radius': '605100.8',
'Period': '224.698'}, 'Moon': {'Orbital Radius': '18128500', 'Radius':
'173700.10', 'Period': '27.321582'}, 'Triton': {'Orbital Radius':
'40000000', 'Radius': '135300', 'Period': '-5.8'}, 'Ceres': {'Orbital
Radius': '130995855', 'Radius': '48700', 'Period': '1679.67'},
'Mimas': {'Orbital Radius': '8433396', 'Radius': '20600', 'Period':
'0.9'}, 'Titan': {'Orbital Radius': '50706000', 'Radius': '257600',
'Period': '15.945'}, 'Ganymede': {'Orbital Radius': '47160000',
'Radius': '263400', 'Period': '7.15455296'}, 'Umbriel': {'Orbital
Radius': '11983500', 'Radius': '60000', 'Period': '4.144177'},
'Callisto': {'Orbital Radius': '69700000', 'Radius': '241000',
'Period': '16.6890184'}, 'Jupiter': {'Satellites':
'Io,Europa,Ganymede,Callisto', 'Orbital Radius': '210573600',
'Radius': '7149200', 'Period': '4332.59'}, 'Io': {'Orbital Radius':
'22000000', 'Radius': '182100.3', 'Period': '1.7691377186'}, 'Earth':
{'Satellites': 'Moon', 'Orbital Radius': '77098290', 'Radius':
'637100.0', 'Period': '365.256363004'}, 'Dione': {'Orbital Radius':
'17106000', 'Radius': '56000', 'Period': '2.7'}, 'Iapetus': {'Orbital
Radius': '72285891', 'Radius': '75000', 'Period': '79'}}

and this is my code for a solar animation. My question is that does my code continually go and check every ‘Object’ for ‘Satellites’ and then print them if they exist? is it recursive? I’ve been working hard all day to make it check and then print!

#code for solar animation
#t = period
#x,y = rootobject coordinates

print("flush false")
scale = 600/max([planets[key]['Orbital Radius'] for key in planets])
t = 0
x = 400
y = 300
print("fillcircle",400,300,planets['Sun']['Radius']*scale)
print("text ", "\"Sun\"",x + planets['Sun']['Radius']*scale,y)


def satellites(planets):
    for 'Satellites' in planets:
        if 'Satellites' not in 'Object':
            return
        else:
            print("refresh")
            print("colour 0 0 0")
            print("clear")
            print("colour 255 255 255")
            r_sat = planets['Object']['Satellites']['Orbital Radius']*scale
            print("circle",x,y,r_sat)
            r_satX = x + math.sin(t*2*math.pi/planets['Object']['Satellites']['Period'])*r_sat
            r_satY = y + math.cos(t*2*math.pi/planets['Object']['Satellites']['Period'])*r_sat
            print("fillcircle",r_satX,r_satY,planets['Object']['Satellites']['Radius']*scale)
            print("text ",['Object']['Satellites'],r_satX + planets['Object']['Satellites']['Radius']*scale,r_satY)
            t += 0.02

system = satellites(planets)
print(system)

I am nearing my limits for this, I’ve tried everything I can think of but I need 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-06-14T22:00:01+00:00Added an answer on June 14, 2026 at 10:00 pm

    1. My question is that does my code continually go and check every ‘Object’ for ‘Satellites’ and then print them if they exist?

    No, your function satellites() it isn’t valid python. That are quite a few mistakes with it but I can see you are heading in the right direction, sort of.

    for 'Satellites' in planets:
        if 'Satellites' not in 'Object':
            return
    

    'Satellites' is just a string so for 'string' in 'iterable object' isn’t valid python.

    if 'Satellites' not in 'Object': has the same problem as the previous line, the string 'Satellites' will never be in the string 'Object'

    I believe this is what you wanted to do:

    for key in planets.keys():               # For all keys in the outer dic 
        if 'Satellites' not in planets[key]: # Does inner dic have key 'Satellites'
            return
    

    Where key is the variable (not a string) that takes each value contained in planets once round the loop. So the first time the value of key is 'Mecury', the second time the value of key is 'Sun' and so on.. We then look at the inner dictionary planets[key] and check if that dictionary has the key 'Satellites'.

    Then uses planets[key]['Satellites'] not planets['Object']['Satellites'] as the key 'Object' never exists (look at the input file).

    2. Is it recursive?

    No, Your function satellites() never calls itselfs, re-read my answer on recursion: python3 recursion animation in QuickDraw

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

Sidebar

Related Questions

I need help with CMD scripts. Here is my problem: I have list of
I have an interesting SQL problem that I need help with. Here is the
I have a complicated problem, and I need help. I have a base case,
I need some help in solving this problem. We have a large amount of
I have the following problem: i need to convert a decimal number to string.
I have the following problem. I need to calculate the Shrout & Fleiss ICC's
I am new in xslt. I have the following problem. I need within an
I need some help with my problem. I have created a list of all
I am stuck and need outside help from JSF experts with the following problem:
Good afternoon, I need help to solve the following problem: I need to restrict

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.