• stupidcasey@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    21 hours ago

    Gotta say, Ai can be kinda neat:

    # Assuming these are inputs
    num = int(input("Enter a number: "))
    string_input = input("Enter a string: ")
    
    def process_data(data_list, number):
        result = ""
        if number == 2:
            for char in data_list:
                result += data_list[char]
            return result
        elif number == 1:
            result = data_list[number]
            for char in data_list:
                result += data_list[char]
            return result
    
    # Main function call
    output = process_data(list(string_input), num)
    print(output)
    
    # This seems like an external tool for copying to clipboard, e.g., pyperclip
    import pyperclip
    pyperclip.copy(output)