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

Answers

Answer 1

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!


Related Questions

Lighting for a location shot is run by the team at the location.


True

False

Answers

Answer:

I'm not worng it's true

PLS HURRY!
Which steps are used to view and delete the macros that have been enabled in a workbook?


Press Alt+F8, select the macro to be deleted, and press Delete.

Under the Developer tab, click the Macros button in the Code group, select the macro to delete, and press Delete.

Press Alt+F11, click Tools, and select Macros; then, select the macro to delete and press Delete.

All of the options listed are correct.

Answers

Answer:

D. All of the options listed are correct.

Explanation:

A macro, in excel sheet, is an action or series of action that repeats the keystrokes or mouse actions as many times as one wants. To view macro, shortcut key is to Pres Alt+F8; to delete, one needs to select the macro one wants to delete and press Delete button.

The another way to view macro is to go to the Developer tab, and select the Macro option in Code group. And, then select macro need to delete, and press Delete button.

Another shortcut is to press Alt+F11, and click  on Tools tab, click on Macros and then select macro need to be deleted, and press Delete.

So, all the options stated above are correct.

Therefore, option D is correct answer.

What are the main security weaknesses of coaxial cable, twisted pair cable, and fiber optic cable? How might the router itself be a security risk, even if you were using UTP/STP cabling that was insulated to prevent electromagnetic radiation leaks that could be eavesdropped on? What steps might you take to improve security for cabled networks?

Answers

Answer:

Answered below

Explanation:

Coaxial cables weaknesses include; fluctuation of speed during heavy use, leaks at the point of connection and signal loss over long distances. Twisted pair cables are not durable enough and are susceptible to interference. Fibre optic cables are costly and need expertise to install.

Hacked or compromised routers can be infected with malwares that reroutes users to spam sites and also to ddos attacks.

Steps to protect cable networks include; network encryption, physical security, VPN usage, updating networks, auditing and mapping.


Select all the ways in which business professionals might use a spreadsheet in their jobs.
editing graphics
creating a graph for a presentation
tracking financial information
organizing numeric data
conducting a query
making calculations
writing business letters

Answers

Answer:

By making calculation.

Explanation:

Because spreadsheet is a calculation type software.

Which online note-taking device allows students to clip a page from a website and reuse it later?

web clipping tools
electronic sticky notes
offline data storage sites
online data storage sites

Answers

Answer:

The answer is A.) web clipping tools.

Explanation:

Cuz like yeah

Answer: WEB CLIPPING TOOLS

Explanation:

How is video compression accomplished?
O Video compression works by making the pixel size smaller.
O Video compression works by removing the sound.
O Video compression works by smoothing the pixels.
O Video compression works by removing unnecessary parts of frames.

Answers

Answer:

Video compression works by making the pixels smaller.

Explanation:

I went on a boring website that actually knows about this stuff and found the answer. R I P my brain cells.

Answer:

a

Explanation:

Help! Computer Science Discoveries. Hurry its timed

Answers

Answer:

1. categories

2. character

3. code

4. portrait

5. conversation

6. stage

7. Landscape

8. backdrop

Explanation:

I'm not sure what "a visual programming language for children" would be, sorry about that, and sorry if these are wrong .-

How can data consolidation be helpful? Check all that apply
•It can set up automatic updating of data within one worksheet.
•it can summarize data from worksheets in different workbooks.
•it helps to summarize data from worksheets that are not identical.
•it combines data from multiple sheets to create one concise table.
• it summarizes data based on how many rows and columns have values.

Answers

Answer:2,3, and 4

Explanation:

Answer:

2,3,4

Explanation:

Which programming language's program structure is similar to its syntax?
O A. Java
OB.
B. Python
Ос. .
PHP
OD. LISP

Answers

Answer:

I believe it is java.

Explanation:


Select the correct answer from each drop-down menu.
Jeff writes a blog on digital photography. His most recent post was about visual artifacts. Identify the visual artifacts in the sentences below.
. A visual artifact of digital projectors is called
An inappropriate color difference in an image is called

Answers

Answer:

Screen-door effect

Explanation:

Answer:

An inappropriate color difference in an image is called: image noise

A visual artifact of digital projectors is called: fixed-pattern noise

Explanation:

trust me

why did the boy run from the pillow...... wrong answers only

Answers

He thinks there is a demon hiding innit thus, he runs and calls his mom. His mom says "Jimmy there's nothing in that pilow young man!" Jimmy walks back to his room scared if its still there. He hops into bed hoping that he can get a good nights rest. The next day, Jimmy asks if he can go buy another pillow. His mom says "As long as it makes you feel safe then ok." Young Jimmy, jumping in excitement, goes to the checkout zone to buy his new pillow. When they get home, Jimmy and his mom eat dinner and then head for bed. Jimmy hops into bed and knows that everything will be ok. The end.

How does applying Fontworks effects to text on an advertising flyer change the text?
O The text cannot be resized.
O The text is shown as an object.
O The text cannot be edited
O The text is permanently in its current location.

Answers

Answer:

A

Explanation:

Applying Font works effects to text on an advertising flyer changes the text is, the text cannot be resized. The correct option is A.

What is fontwork?

Font work shape: From the expanded toolbar, select a shape to alter the shape of the currently selected object. The Shapes toolbar's extended menu.

You can design graphical text art items using Font work to add appeal to your work. You have a lot of options because there are numerous parameters for text art items (including line, area, position, size, and more).

You'll undoubtedly discover one that works for your paper. adjusts the object's character height. Changes between all letters being the same height and regular height (some characters being taller than others, such as capital letters, d, h, and l). Right: the same letter heights as the letters on the left.

Therefore, the correct option is A, The text cannot be resized.

To learn more about fontwork, refer to the link:

https://brainly.com/question/10130609

#SPJ5

edhesive: 2.5 Code Practice answer

Answers

Answer: can you tell me what you need help with

Explanation:thank you

Answer:

import random

a = random.randint(1,10)

b = random.randint(1,10)

answer = a * b

print (str(a) + " * " + str(b) + " = " + str(answer))

Explanation:

Hope this helps!

Which line correctly starts the definition of a class named "team"?


class team:

def team():

class team():

def team:

Answers

Answer:

A

Explanation:

The line correctly starts the definition of a class named “team” is the class team:. The correct option is A.

What are the definitions?

The definition is the precise explanation of a word, particularly as it appears in a dictionary. Meaning provides a broad explanation of a word or topic. The primary distinction between definition and meaning is this. Understanding what a term implies is made possible by both its definition and its meaning.

When we write a definition of a word. The word is written before, and it is written with a colon sign. The word is only written and after the word place colon, then the definition of the word.

The definition of the word team is a collection of people who cooperate to accomplish a common objective.

Therefore, the correct option is A. class team:

To learn more about definitions, refer to the link:

https://brainly.com/question/23008740

#SPJ2

Which phrase best describes a scenario in Excel 2016?


A. a type of what-if analysis that allows a user to define a single variable for a single function or formula

B. a type of what-if analysis that allows a user to define multiple variables for multiple functions or formulas

C. a type of chart analysis that allows a user to predict outcomes using data

D. a type of chart analysis that allows a user to set predetermined outcomes using data

Answers

A phrase which best describes a scenario in Microsoft Excel 2016 is: B. a type of what-if analysis that allows a user to define multiple variables for multiple functions or formulas.

What is Microsoft Excel?

Microsoft Excel simply refers to a software application that is designed and developed by Microsoft Inc., for analyzing and displaying spreadsheet documents, especially by using rows and columns in a tabulated format.

The types of function in Microsoft Excel.

In Microsoft Excel, there are different types of functions which are referred to as "predefined formulas" and these include the following:

Sum functionMaximum functionAverage functionCount functionIF functionMinimum function

In conclusion, Microsoft Excel 2016 is designed and developed by Microsoft Inc., as a type of what-if analysis which avail its end users to use multiple variables in defining multiple functions or formulas.

Read more on Excel function here: https://brainly.com/question/14371857

#SPJ1

ASAP
Which of the following is best described as a network that covers a large geographic area (such as a city, country, or the world) using a communications channel that combines many types of media such as telephone lines, cables, and radio waves.
LAN
WAN
W.W.
WLAN

Answers

either LAN or WLAN but i’m pretty sure it’s LAN. hope that narrows it down a tiny bit

Why operating system is important software for computer. give any five reasons.

Answers

Answer:

The description of the discussion is summarized throughout the explanation segment elsewhere here.

Explanation:

The operating quality would be an essential technology running on a computer. It maintains the recent memories but instead mechanisms including its desktop, along with all the latter's hardware as well as software components.  Perhaps it facilitates communication with your device without learning how to read your device's dialect.  

Franklin has a photographic assignment, and he needs to print some photographs using Adobe Photoshop. Which feature will help him see the
printed version of the document on the screen before he actually prints it?
The
feature in Photoshop will help Franklin see the printed version of the document on the screen before he actually
prints it.

Answers

Answer:

print preview

Explanation: i got it correct in plato

Answer:

print preview

Explanation:

on plato/edmentum

Need help on this it’s the last one I need

Answers

Design a ringtone like it says
Other Questions
can you please help me with this question What was the impact of westernization on the Chinese economy? Blood has codominance, if you are heterozygous, you can only show one of the dominant traits. True False You get a $400 base salary for your job selling totes. You also get a 4% commission on allyour sales. If your take home pay for the month was $756. What were your total sales? How did Nikola Tesla negatively affect Thomas Edison? Kevin McCormick is buying a sports utility vehicle at a car dealership. The base price is $25,565; the factory installed options totaled $2,764; and the destination charge is $495. What is the sticker price? Consider the equation 2x +2y =8 An atom of element Be has four protons, four electrons, and five neutrons.Which element below could be an isotope of this atom? 1. Spanish is most commonly spoken in what countries?2. true or false? Spanish is spoken differently in every country? 6 + 18r = 20r - 18 - 4r Why are so many young rappers being murdered at an alarming rate? MUST BE 3-4 SENTENCES ILL CASHAPP What was the physical geography like in the New England Colonies? Solve for y .............. PLEASE ANSWER, ILL GIVE BRAINLIEST!!!!!!!i have enough points for brainliest answer all questions provided in the images CORRECTLY and you get brainliest Solve the proportion to find the value of y 2/9 = y/3.6A) y = 0.04B) y = 0.8C) y =0.4D) y = 0.08 PLEASE HELP ITS DUE IN 10 MINS! WILL MARK BRANLIEST!! What is Queen Elizabeth II's surname? The third and final step in the test-taking process isturning in the test.answering all the questions.reviewing the completed test.correcting the test. Define Work And its types What is the root of the polynomial equation *(x-2)(x+3) - 18? Use a graphing calculator and a system ofequations.O-3O2O 3