I'm trying to decode the encrypted message with the translations / replacements that I have assigned in the code. However, when I run the code, it soleley prints the encrypted text and not the expected outcome. How can I solve this? I am sorry if this an easy solution / problem, I am a beginner.
EDIT: I solved the original issue, however, now its printing the wrong output. Instead of BCDD, it prints AAAAAAAAAAAAA. I would prefer not using imports.
def main():
encrypted = "**^^^****^^^^" #expected outcome is BCDD
if "*" or "^" in encrypted:
encrypted = encrypted.replace("*", "A")
encrypted = encrypted.replace("^", "A")
if "**" or "^^" in encrypted:
encrypted = encrypted.replace("**", "B")
encrypted = encrypted.replace("^^", "B")
if "***" or "^^^" in encrypted:
encrypted = encrypted.replace("***", "C")
encrypted = encrypted.replace("^^^", "C")
if "****" or "^^^^" in encrypted:
encrypted = encrypted.replace("****", "D")
encrypted = encrypted.replace("^^^^", "D")
if "*****" or "^^^^^" in encrypted:
encrypted = encrypted.replace("*****", "E")
encrypted = encrypted.replace("^^^^^", "E")
print(encrypted)
main()