[Python] Pyton - How to take input and find that string in a list and get the output of a...

Discussão em 'Python' iniciado por Stack, Agosto 15, 2025.

  1. Stack

    Stack Membro Participativo

    I'm currently taking a python course and trying to create a code cipher. I'm trying to create a function by taking an input and need to find that string input in a list and have it return another string in the list depending on how many intervals i have input. Apologies if this isn't clear, I'm very new to programming. I know there is a for loop involved but I can't figure out the logic. Code below:

    alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

    direction = input("Type 'encode' to encrypt, type 'decode' to decrypt:\n").lower() text = input("Type your message:\n").lower() shift = int(input("Type the shift number:\n"))

    def encrypt(original_text=text, shift_amount=shift):

    Continue reading...

Compartilhe esta Página