1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ASHA 777 [7]
2 years ago
8

Program a substitution cipher in Python. Create 2 functions one for encryption and the other for decryption ( get the text as th

e parameter).
Computers and Technology
1 answer:
raketka [301]2 years ago
7 0

alphabet = "abcdefghijklmnopqrstuvwxyz"

def encrypt(txt):

   shift = int(input("Enter the shift: "))

   new_txt = ""

   for x in txt:

       if x in alphabet:

           if alphabet.index(x)+shift >= len(alphabet):

               new_txt += alphabet[(alphabet.index(x)+shift - len(alphabet))]

           else:

               new_txt += alphabet[alphabet.index(x)+shift]

       else:

           new_txt += x

   return new_txt

def decrpyt(txt):

   shift = int(input("Enter the known shift: "))

   new_txt = ""

   for x in txt:

       if x in alphabet:

           new_txt += alphabet[alphabet.index(x) - shift]

       else:

           new_txt += x

   return new_txt

print(encrypt("yellow dog."))

print(decrpyt("lryybj qbt."))

My code works with lowercase text only. If you need me to modify the code, I can do that. I tested my code with a shift of 13 in both the encryption and decryption. I hope this helps!

You might be interested in
I analyze data, as a consultant, for companies making important business decisions. In order to get my point across, which of th
ladessa [460]

Answer:

3

Explanation:

I've just taken the test and made a 100. 3 is the most logical answer aswell, it has more of an effect than the others.

4 0
3 years ago
Which type of ICS facility is used to temporarily position and account for personnel, supplies, and equipment awaiting assignmen
Black_prince [1.1K]

Answer:

C. Staging Area

Explanation:

According to my research on different ICS facilities, I can say that based on the information provided within the question the facility being described here is called a Staging Area. Like mentioned in the question a staging area is a location set up at an incident where resources and personnel can be placed while waiting on instructions to proceed with an operation or assignment.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

6 0
3 years ago
A simple system is to be designed to allow for the selling of old books. There are two different types of users: buyers and sell
VMariaS [17]
Yes yes yes yes yeah yes
7 0
3 years ago
What are the steps to configure user information in a document?
chubhunter [2.5K]

Answer:

file, properties, options, general

Explanation:

4 0
2 years ago
Read 2 more answers
You and three of your friends decide to hike the Appalachian Trail, a 2175-mile trail running from Georgia to Maine, starting wh
kozerog [31]

Answer:

The things to do:

a. Lie down flat.

b. Call your friend on phone to inform him of the situation, if he is not already aware.

c. Instruct him to call the rescue team and a helicopter ambulance.

d. Make a video call to your doctor and ask her for first aid instructions.  She can use HIPAA compliant video-conferencing tools to initiate consultations and treatment with you from the far distance.

e. Follow your doctor's instructions.

Explanation:

Telemedicine is the extension of medical services to patients in remote places.  This practise is facilitated by the use of telecommunication devices and telemedical equipment.  Telemedicine is made possible by technological advancements.  Many healthcare practitioners have embraced the practice and offer their patients telemedical services as the need arises.

Modern technology has enabled doctors to consult patients by using HIPAA compliant video-conferencing tools.

HIPAA stands for the Health Insurance Portability and Accountability Act of 1996, which was enacted by the 104th United States Congress and signed by President Bill Clinton in 1996.  The Act encourages Healthcare access to remote patients, medical consultation and treatment portability, and secures health information, among others.

7 0
3 years ago
Other questions:
  • Which sentences in the passage show the preventive measures to avoid data breach?
    9·1 answer
  • What characteristics need to be exhibited by an organisation to improve its software process?
    7·1 answer
  • This whole page needs to be done please help?
    13·1 answer
  • 25 POINTS HELP PLEASE IM TIMED
    15·1 answer
  • Any material that comes into contact with the body must be __________.
    6·1 answer
  • If you want to transfer information transform STM to LTM, it is essential that you make the information ______________________.
    9·1 answer
  • You have to cut a wood stick into pieces. The most affordable company, The Analog Cutting Machinery, Inc. (ACM), charges money a
    10·1 answer
  • Question in photo below
    13·2 answers
  • Which of the following statements is TRUE? A. A name error occurs if the variable is referenced before it is declared. B. A name
    12·1 answer
  • The rectangular symbol in flowchart<br> is used to denote dash
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!