Вивчіть маніпуляцію рядками, створивши шифр - Крок 48

Розкажіть нам, що сталося:

text = 'Hello Zaira'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''

for char in text.lower():
    if char == '':
        encrypted_text += char
    else:
        index = alphabet.find(char)
        new_index = (index + shift) % len(alphabet)
        encrypted_text += alphabet[new_index]
print('Plain text:', text)
print('Encrypted text:', encrypted_text) 

Ваш код


# User Editable Region

text = 'Hello Zaira'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''

for char in text.lower():
    if char == '':
        encrypted_text += char
    else:
        index = alphabet.find(char)
        new_index = (index + shift) % len(alphabet)
        encrypted_text += alphabet[new_index]
print('Plain text:', text)
print('Encrypted text:', encrypted_text)

# User Editable Region

Інформація про ваш браузер:

Агент користувача: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 OPR/95.0.0.0

Інформація про завдання:

Вивчіть маніпуляцію рядками, створивши шифр - Крок 48

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

It keeps writing this message: Print ‘plain text:’, the text after the for loop. No matter how I rearrange

You have to use the exact same letters as the instructions ask for, including capitalization.

I’ve already tried everything, can you copy my code and fix it correctly?

No, I cannot write the answer for you. That’s against the rules.

Like I said, you need to use the exact same letters, including capitalization. What does your code look like when you use the same capitalization.

I just need to make a fix: Print ‘plain text:’, text after the for loop. The task is as follows: Add another call just before the print call and pass ‘plain text:’, text as arguments to print(). Use the same indentation. Well, my code looks like this, I think I did it all like this

I have done it. Thanks a lot)

1 Like