Question

Python code that will allow users to encrypt a tweet while allowing other users the ability...

Python code that will allow users to encrypt a tweet while allowing other users the ability to decrypt it.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#Taking simple encryption (reversing the chars), you can make your own encrypted code likewise:

#CODE:


def encrypt(msg:str):
message = ""
  
translated = ""   
l = len(msg) - 1   
i = l
j = l
while i >= 0 :   
translated = translated + msg[i]
i = i - 1   

return translated
  
while j >= 0:
message = message + translated[j]
j = j - 1
print(message)

def decrypt(msg:str):
message = ""
  
l = len(msg) - 1   
j = l
  
while j >= 0:
message = message + msg[j]
j = j - 1
  
return message
  
def do():
c = input("enter choice:\n1.encrypt\n2.decrypt\n")
  
if c == '1':
en_msg = encrypt(msg = "Hello! This is Chegg.")
print("encrypted msg: ", en_msg)
if c == '2':
de_msg = decrypt(msg = ".ggehC si sihT !olleH")
print("decrypted msg: ", de_msg)
  
  
do()
  

#OUTPUT:

Add a comment
Know the answer?
Add Answer to:
Python code that will allow users to encrypt a tweet while allowing other users the ability...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PYTHON CODE: Encrypt the input from the shell. Decrypt the input. If the temperature is less...

    PYTHON CODE: Encrypt the input from the shell. Decrypt the input. If the temperature is less than 25-degree celsius, print your initial in Green. If the temperature is between 25 and 30 celsius, print your initial in purple. Otherwise, print your initials in red. Upload a screenshot of your output, AND your Python code.

  • write a code that plots columns in a matrix one by one. while plotting, the code...

    write a code that plots columns in a matrix one by one. while plotting, the code should allow 2 seconds to see each column plotted before moving to the other one. During those 2 seconds the user should have the ability to print the plotted vector by clicking it?

  • 1. Write a python code: Using a dictionary, make a text encrypter/decrypter. In decrypt mode, if...

    1. Write a python code: Using a dictionary, make a text encrypter/decrypter. In decrypt mode, if the user inputs “Y r u l8?”, the program should output “Why are you late?”, for example. In encrypt mode, if the user inputs “See you later”, it should output “c u l8r”. Obviously you can’t handle every possible phrase, but add as many as you can. Don’t bother with multiword shortcuts for now (LOL, BRB, etc.) 2. Draw a flowchart of your encryption/decryption...

  • While analyzing network traffic, a security engineer discovers that confidential emails were passing between two users...

    While analyzing network traffic, a security engineer discovers that confidential emails were passing between two users who should not have had this information. The two users deny sending confidential emails to each other. Which of the following security practices would allow for non-repudiation and prevent the users from removing emails such as these from their accounts? (Select TWO). Digital Signature TSIG code signing Legal hold Authentication hashing Transport encryption PLEASE PROVIDE AN EXPLANATION TO THE TWO ANSWER CHOICES AS WELL...

  • code in python pleaSe 9) Allow the user to enter their percentage on an exam. Your...

    code in python pleaSe 9) Allow the user to enter their percentage on an exam. Your program will then display a grade, according to the official Baruch grading scale. (A, A-, B+, etc.). Make sure you use an if-elif-else statement

  • Modify the scripts of Projects 1 and 2 to encrypt and decrypt entire files of text....

    Modify the scripts of Projects 1 and 2 to encrypt and decrypt entire files of text. An example of the program interface is shown below: both images are from one question. I need it in python, please. MINDTAP From Cengage Programming Exercise 4.3 decrypt.pyencrypt.py Instructions 1Modify the progran below Modify the scripts of Projects 1 and 2 to encrypt and decrypt entire files of text. 4 Probject 4.1 5 6 Encypts an input string of the ASCII characters and prints...

  • what are some other levels of protection that users might want to apply to code or...

    what are some other levels of protection that users might want to apply to code or data, in addition to the common read, write, and execute permission?

  • Hi I need some help writing a security code using python mongodb restful api. I just...

    Hi I need some help writing a security code using python mongodb restful api. I just need help on how to provide a security login to user to enter their username and password or to have a block in using extra access once they have logined and they want more access to the databases they will be force to sign out of the server but I just do not know how to start on it can someone show me how...

  • can anyone show me how this code would look in python, I'm studying python while taking...

    can anyone show me how this code would look in python, I'm studying python while taking some classes. I can't seem to understand what this is asking for. • Phase 1 Requirements Code submitted for Phase 1 will only have the following capability. Any additional coding will result in the loss of point. • code will have the main function, including looping until the user enters input of 12 • code will call the printMenu() function • The printMenu() function...

  • 3. What does this code do? Write an explanation in English python n=1 while (n <1000):...

    3. What does this code do? Write an explanation in English python n=1 while (n <1000): print(n) n-n

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT