Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 4, 2019 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/de29a9f336a3148063f69cfbf36400f5 to your computer and use it in GitHub Desktop.
Save codecademydev/de29a9f336a3148063f69cfbf36400f5 to your computer and use it in GitHub Desktop.
Codecademy export
# These are the emails you will be censoring. The open() function is opening the text file that the emails are contained in and the .read() method is allowing us to save their contexts to the following variables:
email_one = open("email_one.txt", "r").read()
email_two = open("email_two.txt", "r").read()
email_three = open("email_three.txt", "r").read()
email_four = open("email_four.txt", "r").read()
def censor(email):
e = email.split()
e = email.replace("learning algorithms", "******** *******")
s = []
for string in e:
s.append(string)
return "".join(s)
print(censor(email_one))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment