What is missing in the code? 1 #!/usr/bin/env python3 2 # -*- coding: utf-8 -*- 3 4
Fantastic news! We've Found the answer you've been seeking!
Question:
What is missing in the code?
Transcribed Image Text:
1 #!/usr/bin/env python3 2 # -*- coding: utf-8 -*- 3 4 5 Source with Python 6 Sydney Dods 7 Aracely 8 @author: andrealuna 10 11 12 13 14 #Works 15 ▾ def encrypt (message, s): 16 result = "" 17 for i in range (len (message)): 18 char = message [i] if (char.isupper()): result + chr((ord(char) + s−65) % 26 + 65) else: 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 ▼ Created on Tue Oct 12 14:54:22 2021 ▼ result + chr((ord(char) + s − 97) % 26 + 97) return result #works but my teacher said I can delete it because EnorDe I can put s= or I can use it def decode(message, s): result = "* for i in range (len (message)): char = message [i] if (char.isupper()): result + chr((ord(char) - s-65) % 26 + 65) else: result + chr((ord(char)s - 97) % 26 + 97) return result #I'm not sure but I think am not giving this function a piece of what it needs to complete w def EnorDe(text, message, s): if text=="Encrypt": elif text=="Decode": s=-1*keyshift return("Cipher: " + decode(message, s)) return ("Cipher:" + encrypt (message, s)) text = input('Encrypt or Decode?') message=input("Insert Message ") s=int (input("Keyshift?") print (EnorDe(text)) ☐ E uitvany anu COUNT WO dictonary DNA Documents Downloads Finaltrial.mp4 Finaltrial2.mp4 guru99.txt Hello World humptydumpty Id_file idnumber image Console 30/A SyntaxError: invalid syntax print(EnorDe(text)) SyntaxError: invalid syntax 10/12/21 2.00 FIV 9/30/21 2:44 PM 10/7/21 3:00 PM 9/19/21 10:06 PM 10/14/21 2:42 PM 9/19/21 10:04 PM In [39]: runfile('/Users/andrealuna/Ceaser decod', wdir='/Us File "/Users/andrealuna/Ceaser decod", line 47 9/19/21 10:20 PM 10/12/21 2:53 PM 8/31/21 3:13 PM 9/21/21 2:39 PM 9/26/21 4:21 PM 9/27/21 5:35 PM 9/15/21 7:42 PM print(EnorDe(text)) SyntaxError: invalid syntax Variable explorer Help F In [40]: runcell(0, '/Users/andrealuna/Ceaser decod') File "/Users/andrealuna/Ceaser decod", line 47 print(EnorDe (text)) SyntaxError: invalid syntax In [42]: In [41]: runcell(0, '/Users/andrealuna/Ceaser decod') File "/Users/andrealuna/Ceaser decod", line 47 1 #!/usr/bin/env python3 2 # -*- coding: utf-8 -*- 3 4 5 Source with Python 6 Sydney Dods 7 Aracely 8 @author: andrealuna 10 11 12 13 14 #Works 15 ▾ def encrypt (message, s): 16 result = "" 17 for i in range (len (message)): 18 char = message [i] if (char.isupper()): result + chr((ord(char) + s−65) % 26 + 65) else: 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 ▼ Created on Tue Oct 12 14:54:22 2021 ▼ result + chr((ord(char) + s − 97) % 26 + 97) return result #works but my teacher said I can delete it because EnorDe I can put s= or I can use it def decode(message, s): result = "* for i in range (len (message)): char = message [i] if (char.isupper()): result + chr((ord(char) - s-65) % 26 + 65) else: result + chr((ord(char)s - 97) % 26 + 97) return result #I'm not sure but I think am not giving this function a piece of what it needs to complete w def EnorDe(text, message, s): if text=="Encrypt": elif text=="Decode": s=-1*keyshift return("Cipher: " + decode(message, s)) return ("Cipher:" + encrypt (message, s)) text = input('Encrypt or Decode?') message=input("Insert Message ") s=int (input("Keyshift?") print (EnorDe(text)) ☐ E uitvany anu COUNT WO dictonary DNA Documents Downloads Finaltrial.mp4 Finaltrial2.mp4 guru99.txt Hello World humptydumpty Id_file idnumber image Console 30/A SyntaxError: invalid syntax print(EnorDe(text)) SyntaxError: invalid syntax 10/12/21 2.00 FIV 9/30/21 2:44 PM 10/7/21 3:00 PM 9/19/21 10:06 PM 10/14/21 2:42 PM 9/19/21 10:04 PM In [39]: runfile('/Users/andrealuna/Ceaser decod', wdir='/Us File "/Users/andrealuna/Ceaser decod", line 47 9/19/21 10:20 PM 10/12/21 2:53 PM 8/31/21 3:13 PM 9/21/21 2:39 PM 9/26/21 4:21 PM 9/27/21 5:35 PM 9/15/21 7:42 PM print(EnorDe(text)) SyntaxError: invalid syntax Variable explorer Help F In [40]: runcell(0, '/Users/andrealuna/Ceaser decod') File "/Users/andrealuna/Ceaser decod", line 47 print(EnorDe (text)) SyntaxError: invalid syntax In [42]: In [41]: runcell(0, '/Users/andrealuna/Ceaser decod') File "/Users/andrealuna/Ceaser decod", line 47
Expert Answer:
Answer rating: 100% (QA)
Python version 38 def encryptmessage s Function that encrypts the given message using the key s and returns the encrypted message The input message on... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
One amount is missing in the following trial balance of proprietary accounts, and another is missing from the trial balance of budgetary accounts of the Save Our Resources Commission of the federal...
-
What important feature is missing in the following scenario? The proportion of people that like chocolate pie the best estimated between 17.8% and 22.4% from a sample of size n = 1, 028. A. The...
-
What Makes a Great Code of Conduct? A code of conduct defines how a company's employees should act on a day-to-day basis. It reflects the organization's daily operations, core values, and overall...
-
Consider a single-output, non-preemptive queueing system. It has three queues connected to the single output, and packets in the queues are handled based on a strict-priority order. The three queues...
-
Define and discuss the idea of separating risk into two parts. Describe each part carefully?
-
1. Explain how the graph of the sine function can be used to graph y = csc(x) For the following, sketch at least two periods of the graph. Identify the period, phase shift, and describe the location...
-
Calculate the range for each of the following sets of data: a. \(9,10,13\) b. \(5,3,9,12\) c. \(6,2,8,12,9,5,7\) d. \(8,4,1,6,14,9,12,5,11,7,4\) e....
-
Lavoie Corp acquired new equipment at a cost of $100000 plus 7% provincial sales tax and 5% GST (GST is a recoverable tax). The company paid $1700 to transport the equipment to its plant. The site...
-
Given that the rate of change in the exchange rate is conditionally normally distributed, if the standard deviation of the 90-day rate of appreciation of the CAD relative to the USD is 4%, what range...
-
A highway has an optional toll lane that drivers may take to reduce the time they spend driving. Drivers pay a small fee to enter the toll lane ($0.25). Then, once they leave the toll lane, they pay...
-
What is the dimension of 'M' in the equations below? Use dimensional analysis. (y + 1) 2(x - 1) m = AP JF/M (1 + 0 = M) (y 1) 2 Where: m = mass flow rate [=] kg/sec A = area [=] m T= temperature [=]...
-
Which of these three options is the better investment? Use the same P and t value throughout. a. An account that earns 8.2% interest compounding semi-annually b. An account that earns 8.17% interest...
-
Suppose that a single firm is a monopolist in a market with the demand function P=200-20. The monopolist has total fixed cost of TFC = 100 and total variable cost of TVC= 200. The monopolist charges...
-
Refer to Figure 15-5. Suppose the economy is in short-run equilibrium above potential GDP, the unemployment rate is very low, and wages and prices are rising. Using the static AD-AS model in the...
-
A duopoly faces inverse market demand of P (Q) = 120 Q, where Q is industry output, The two firms have a constant marginal cost of c = 30 and compete a la Cournot. a) Derive the best-response...
-
Samantha has the following transactions: . She purchases $5,000 worth of a mutual fund with cash from her savings account. . She spends $6,000 on a vacation with cash from her money market account ....
-
Joshua Pty Ltd runs a furniture retailing business. During the tax year 19-20, Joshua provided customers with various loan arrangements to finance the purchase of furniture. Total expenses relating...
-
Gordon and Lisa estimate that they will need $1,875,000 in 40 years for their retirement years. If they can earn 8 percent annually on their funds, how much do they need to save annually?
-
Teresa is a civil engineer who uses her automobile for business. Teresa drove her automobile a total of 21,732 miles during 2012, of which 95 percent was business mileage. The actual cost of...
-
Jason and Mary Wells, friends of yours, were married on December 30, 2012. They know you are studying taxes and have come to you with a question concerning their filing status. Jason and Mary would...
-
Linda and Richard are married and file a joint return for 2012. During the year, Linda, who works as an accountant for a national airline, used $2,100 worth of free passes for travel on the airline;...
-
Discuss why it is important to report significant changes in a patients condition to the treating physician.
-
Describe the various errors that can occur in the administration of medications.
-
Discuss under what circumstances a nurse has a duty to question a patients care.
Study smarter with the SolutionInn App