Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list_of_decripted_words = (str(input())).split()
- print_result = ""
- for index in range(0, len(list_of_decripted_words)):
- current_decrypted_word = (list_of_decripted_words[index])
- current_decrypted_word_list = []
- for letter in current_decrypted_word:
- current_decrypted_word_list.append(letter)
- first_digit = current_decrypted_word_list.pop(0)
- second_digit = current_decrypted_word_list.pop(0)
- digits = first_digit + "" + second_digit
- if current_decrypted_word_list[0] == "1" or current_decrypted_word_list[0] == "2" or current_decrypted_word_list[0] == "3" or current_decrypted_word_list[0] == "4" or current_decrypted_word_list[0] == "5" or current_decrypted_word_list[0] == "6" or current_decrypted_word_list[0] == "7" or current_decrypted_word_list[0] == "8" or current_decrypted_word_list[0] == "9" or current_decrypted_word_list[0] == "0":
- third_digit = current_decrypted_word_list.pop(0)
- digits += third_digit
- first_letter = chr(int(digits))
- if len(current_decrypted_word_list) > 1:
- second_letter = current_decrypted_word_list.pop(0)
- last_letter = current_decrypted_word_list.pop()
- current_decrypted_word_list.insert(0, last_letter)
- current_decrypted_word_list.append(second_letter)
- current_decrypted_word_list.insert(0, first_letter)
- print_result+= ("".join(current_decrypted_word_list) + " ")
- print(print_result)
Advertisement
Comments
-
- Your script appears to be designed to decrypt a list of words that have been encrypted in a specific way. Here's a breakdown of what the code does:
- 1. Accepts a string of input from the user and ssplits it into a list of words.
- 2. Initializes an empty string called 'print_result'
- 3. Iterates over each word in the list of decrypted words.
- 4. For each word, converts it into a list of letters
- 5. Removes the first two letters of the list and stores them as a string called 'digits'.
- 6. If the first letter of the list is a digit, removes that letter as well and adds it to 'digits'.
- 7. Converts 'digits' into a character by using the 'chr()' function and storing it in a variable called 'first_letter'.
- 8. If the list of letters has more than 1 element, removes the second letter and the last letter, and reorders the list so that the last letter is the first element and the second letter is the last element.
- 9. Inserts 'first_letter' at the beginning of the lsit of letters.
- 10. Joins the list of letters into a single string and adds it to 'print_result', followed by a space character.
- 11. After all the words have been processed, prints 'print_result'.
- I haven't really decrypted the code however, helping others.
-
- You are absolutely correct. I am just pasting the solution of a task that I've done for my university, which is named Desipher this! I didn't mean for anyone to actually try and desipher it. :)
Add Comment
Please, Sign In to add comment
Advertisement