Jump to content

Featured Replies

I was working trying to figure out how to map input to output and came up with this program.

def create_mapping_function(inputData, outputData):
    mapping = []
    # map the same to the same
    for i in range(0,len(inputData)):
        for o in range(0,len(outputData)):
            if outputData[o] == inputData[i]:
                # mapping position to position
                # this shows the mapping values.
                mapping.append([i,o])
    return mapping
inputData = input_data()
outputData = output_data()


mapping = create_mapping_function(inputData, outputData)

# print(f)

# use mapping and save them as a mapping function.

inputData    = ['h','e','l','l','o']

# mapping   = f
# # input a unique list with a specific length
#f(x)
def mapping_function(inputData, mapping):
    outputData = []
    for i in range(0,len(inputData)):
        outputData.append(0) # placeholders

    for i in range(0,len(inputData)):
        outputData[mapping[i][1]] = inputData[mapping[i][0]]

    return outputData

output = mapping_function(inputData, mapping)
print(output)

What it is doing to taking an input and output and then finding there common relationships.

Afterwards it outputs the mapping with user define input.

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.