correct code , when 12 plants given with sign , duplicte 7,and g,ku,sha poitins

this is part 2 code,   

    /* repeat ing, 7 house and 5,9  4,8  3,10 position s            / part1 , and par2 , or part 3 is there.

/*part1: inputs as similar to portal, line byline; gives, all planters.*/

/part3: fomrat again houses as per Lagna , lagna as house1 and naming change plants */ execute.

---------

 H1: ['Gur+']

H2: ['Cha+', 'Sha-']

H3: []

H4: []

H5: ['Kuj+', 'Sur+', 'Gur+', 'Sha-', 'Bho']

H6: ['Shu-', 'Bhd-', 'Mitra-', 'Ket+', 'Rah-', 'Chitra-']

H7: ['Gur+']

H8: ['Sha-', 'Cha+', 'Kuj+']

H9: ['Lag', 'Gur+']

H10: ['Sha-']

H11: ['Bho', 'Kuj+', 'Sur+']

H12: ['Rah-', 'Chitra-', 'Kuj+', 'Shu-', 'Bhd-', 'Mitra-', 'Ket+']


=== Code Execution Successful ===



-----

# Initial setup

houses = {

    'H1': ['Gur+'],

    'H2': ['Cha+'],

    'H3': [],

    'H4': [],

    'H5': ['Kuj+', 'Sur+'],

    'H6': ['Shu-', 'Bhd-', 'Mitra-', 'Ket+'],

    'H7': [],

    'H8': ['Sha-'],

    'H9': ['Lag'],

    'H10': [],

    'H11': ['Bho'],

    'H12': ['Rah-', 'Chitra-']

}


# List of house keys

house_keys = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'H7', 'H8', 'H9', 'H10', 'H11', 'H12']


# Function to remove the sign from planet names

def remove_sign(planet):

    return planet.rstrip('+-')


# Special handling for specific planets and their additional positions

special_planet_mapping = {

    'Gur': [4, 8, 6],

    'Kuj': [3, 7, 6],

    'Cha': [6],

    'Sur': [6],

    'Sha': [2, 9, 6],

    'Rah': [6],

    'Bho': [6],

    'Chitra': [6],

    'Shu': [6],

    'Mitra': [6],

    'Ket': [6],

    'Bhd': [6]

}


# Create a copy of the original houses to update them

updated_houses = {key: planets.copy() for key, planets in houses.items()}


# Iterate through the houses and add planets accordingly

for house, planets in houses.items():

    current_house_index = house_keys.index(house)

    

    for planet in planets:

        base_planet = remove_sign(planet)  # Get the planet name without the sign

        

        # Avoid duplicating Lag

        if base_planet == "Lag":

            continue


        # Add to the same house (original entry)

        if planet not in updated_houses[house]:  # Avoid duplicates

            updated_houses[house].append(planet)


        # Add special planets based on their mapping

        if base_planet in special_planet_mapping:

            for offset in special_planet_mapping[base_planet]:

                next_house_index = (current_house_index + offset) % 12  # Calculate the new index

                next_house = house_keys[next_house_index]

                

                # Add the planet to the calculated house if it doesn't already exist

                if planet not in updated_houses[next_house]:

                    updated_houses[next_house].append(planet)


# Display the updated houses

for house, planets in updated_houses.items():

    print(f"{house}: {planets}")


Popular posts from this blog

pss book : శ్రీకృష్ణుడు దేవుడా, భగవంతుడా completed , second review needed. 26th April 2024

pss book: గురు ప్రార్థనామంజరి . completed 21st july 2024

pss book: కధల జ్ఞానము read review pending. 25th june 2024