Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import math import random import string import collections import datetime import re import time import copy def drawPascalsTriangle(n) : your code here... # end def

import math import random import string import collections import datetime import re import time import copy  def drawPascalsTriangle(n) : your code here... # end def def alphaFrequency(userString) : your code here... # end def def encryptStr(userString, n) : your code here... # end def  def main( ) : myStr = """ You're an interesting species, an interesting mix. You're capable of such beautiful dreams and such horrible nightmares. You feel so lost, so cut off, so alone, only you're not. See, in all our searching, the only thing we've found that makes the emptiness bearable is each other. Contact --1997--""" for i in range(1, 20, 4) : drawPascalsTriangle(i) alphaFrequency(myStr) for i in list([2, 10, 25, 26, 1000, 13]) : encryptStr(myStr, i) # end main( ) if __name__ == "__main__" : main( )

Question #3 Write a Python user-defined function that accepts a string and a number 'n' representing a shift index and encrypts the string by substituting (ciphering) each alphabetic letter only with a letter found by moving n places down the alphabet (wrapping around to the beginning when required). The function prototype MUST be: def encryptStr(userString, n) For example, if the string was: "abc-xyz", and the shift value was: 3, then the function call: encryptStr("abc-xyz", 3) would display and return the encrypted string: "def-abc" For more information, please visit this link: https://en.wikipedia.org/wiki/Caesar_cipher 

Kag'dq mz uzfqdqefuzs ebqouqe, mz uzfqdqefuzs yuj. Kag'dq ombmnxq ar egot nqmgfurgx pdqmye mzp egot taddunxq zustfymdqe. Kag rqqx ea xaef, ea ogf arr, ea mxazq, azxk kag'dq zaf. Eqq, uz mxx agd eqmdotuzs, ftq azxk ftuzs iq'hq ragzp ftmf ymwqe ftq qybfuzqee nqmdmnxq ue qmot aftqd. Oazfmof --1997--

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

Name some or all of the rules of law that this landlord broke.

Answered: 1 week ago

Question

Define the term "Leasing"

Answered: 1 week ago

Question

What do you mean by Dividend ?

Answered: 1 week ago

Question

What is database?

Answered: 1 week ago

Question

What are Mergers ?

Answered: 1 week ago