Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
