Untitled

 avatar
unknown
plain_text
5 months ago
675 B
3
Indexable
def generateListUsingTwoNumber(inputNum1, inputNum2, outputArrayLength):
    result = []
    
    # Add the initial two numbers
    result.append(inputNum1)
    result.append(inputNum2)
    
    # Generate subsequent numbers
    while len(result) < outputArrayLength:
        # Concatenate the last two numbers in the list
        new_num = int(str(result[-2]) + str(result[-1]))
        result.append(new_num)
    
    return result

# Example usage
if __name__ == "__main__":
    input1 = 5
    input2 = 6
    length = 5
    output = generateListUsingTwoNumber(input1, input2, length)
    print(f"Input: {input1}, {input2}, Length: {length}")
    print(f"Output: {output}")
Editor is loading...
Leave a Comment