Planet Status Initialization

Report a typo

You're working on a space exploration game and below is the code that initializes planetary data for new game sessions.

def init_planet_status() -> dict[str, str]:
    names_input = input()
    planet_names = [name.strip() for name in names_input.split(",")]

    default_status = input()

    inited_status_dict = dict.fromkeys(planet_names, default_status)
    return inited_status_dict

Describe the functionality of this code for an AI assistant by focusing on its overall purpose and what it achieves, rather than detailing each line. Modify the main function and the rules it follows to accomplish its task.

The AI assistant will generate a new code based on your description. The generated code doesn't need to be identical to the code above, but it should achieve the same outcome.
Write a prompt to generate Python 3 code
GENERATED CODE:





Create a free account to access the full topic