Answered step by step
Verified Expert Solution
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 #2 Write a Python user-defined function that accepts a string of any length and first displays the string followed by a horizontal frequency graph of all ALPHABETIC letters only in the string (in alphabetical order). Case of letters, spaces, and all non-alphabetic characters are to be ignored! The function prototype MUST be: def alphaFrequency(userString) For example, the function call: alphaFrequency("This is a Python test 123!") would display: This is a Python test 123! a=1 * e=1 * h=2 ** i=2 ** n=1 * o=1 * p=1 * s=3 *** t=4 **** y=1 * HINT: Consider using Python's upper( ), lower( ), and ord( ) functions and string.ascii_lowercase and string.ascii_uppercase to complete your solution.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started