By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Help convert leet file and then writing in english to a new file

P: 1
print('''Welcome to the Leet Speak Translator \n
If you have a file that is written in leeet,
speak, we can translate it back to normal
English for you. \n
Just give me the name of a file you want
to have translated, and the name you want
for the translated file.''')

filename=input("Leet file name?")
filename2=input("English File name? :")
leet_letters="48CD3FGHIJK1MN0PQR57UVWXYZ@bcd3fghij k1mn0pqr57uvwxyz"
eng_letters="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk lmnopqrstuvwxyz"

def leet_ch():
fin=open(filename, "r")
for leet_ch in fin:
leet_ch=leet_ch.strip()
return leet_ch
fin.close()

def translate(leet_ch):

for i in range(len(leet_letters)):
if leet_letters[i]==leet_ch:
return (eng_letters[i])
return leet_ch
def writing():
fout=open(filename2, "w")
for line in fout:
fout.write(str(eng_letters[i])+"\n")
fout.close()

def main():
leet_ch()
translate(leet_ch())
writing()


main()
Mar 30 '18 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 614
There is no way to understand your code without proper indentation. Use the code button at the top in the icons. Also we would have to have some test input in order to run the program. First, take a look at "The Return Statement" at http://www.tutorialspoint.com/python..._functions.htm
Mar 30 '18 #2

Post your reply

Sign in to post your reply or Sign up for a free account.