Question: Hello, I need help with this following Python problem.. Thank you in advance! In the cell below, there is a function that is not operating
Hello, I need help with this following Python problem.. Thank you in advance!

In the cell below, there is a function that is not operating as anticipated. new_encrypt is supposed to take a string as input and return the reverse alphabetical string as output, meaning, given a character, return the capitalized character in the reverse position within the alphabet. For example, if the input character is 'B' or 'b', the function would store 'Y' in the output string. If the character is 'A' or 'a', the function would store '2'. (and vice versa: the input '2' or '2' would store 'A'). Specifically, if the input_string were "ABc", the function would return : 'ZYX' Debug, edit, and test the function provided below so that it accomplishes the intended goal. 1 def new_encrypt( ) : 2 alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 3 reverse_alpha = 'ZYXWVUTSRQPONMLKJIHGFEDCBA' 4 5 for char in input_string: 6 if char in alpha: 7 position = alpha.find(char) 8 output_string += reverse_alpha[position] 9 else: 10 output_string = None 11 break 12 13 # YOUR CODE HERE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
