Hi, I need help in changing this phyton code to Dr. Racket. Please. def encode(str1): str2 = str1.upper() ans = "" for i in range(len(str1)): if str2[i] >= 'A' and str2[i]


Hi, I need help in changing this phyton code to
Dr. Racket.
Please.


def encode(str1):
    str2 = str1.upper()
    ans = ""
    for i in range(len(str1)):
        if str2[i] >= 'A' and str2[i] <=>
            temp = chr(ord('Z') - ord(str2[i]) + ord('A'))
            ans+= temp + " "
    print(ans)


The prompt:



  • Each letter will be replaced by the uppercase letter at the opposite end of the English alphabet.
    In other words, A or a will become Z, B or b will become Y, C or c will become X, ..., Z or z will become A.

  • Other characters such as spaces, punctuation, numeric digits, etc. are not included in the encrypted message.


Example:


> (encode "Cat")
"X Z G"
> (encode "A")
"Z"



Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here