Question 2 Edit Metadata Given a list (characterList) containing the alphabet, write a Python program for randomly generating a list of n letters where n is input from the user. The program then shows the most common letter in the generated list and how many times it is repeated. If there is more than one most common letter with equal replication, you can select any one of them. The program should consist of three functions: generateList function to take 2 arguments; the character List and n as input and retum the generated list with length n mostCommonChar function to receive a list of charcaters and returns as a tuple the most common character and the number of its repetitions. ■ main function is to read the value of n and call generateList and mostCommonChar functions. alphabetList=["a","b","c", ","e","f". "g","h","","","K" HINT to compare your output with sample runs, use seed(50) Edit Metadata **Sample run1** Enter the length of the text to be genrated: 15 The generated text is ['p', '1', '1', 'u', 'h', 'w', The most common letter is p with 2 times **Sample run2** Enter the length of the text to be genrated: 20 'y', 'k', 'c', 'r', 'k', 'h', '', 'r'] The generated text is ['p', '1', '1', 'u', 'h', 'w', 'p', 'y', 'k', 'c', '', 'k', '1'] The most common letter is 1 with 3 times **Sample run3** Enter the length of the text to be genrated: 25 The generated text is I'p', '1', '1', 'u', 'h', 'w', 'p', 'y', 'k', 'c', 'r', 'k', 'h', 'v', '', 'c', 'e', '1', 'd', '1', 'k', 'h', 'g', 'c','k'] The most common letter is k with 4 times I

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Alert dont submit AI generated answer.

Question 2
Edit Metadata
Given a list (characterList) containing the alphabet, write a Python program for randomly generating a list of n letters where n is input from the user. The program
then shows the most common letter in the generated list and how many times it is repeated. If there is more than one most common letter with equal replication,
you can select any one of them.
The program should consist of three functions:
generateList function to take 2 arguments; the character List and n as input and retum the generated list with length n
mostCommonChar function to receive a list of charcaters and returns as a tuple the most common character and the number of its repetitions.
■ main function is to read the value of n and call generateList and mostCommonChar functions.
alphabetList=["a","b","c", ","e","f". "g","h","","","K"
HINT
to compare your output with sample runs, use seed(50)
Edit Metadata
**Sample run1**
Enter the length of the text to be genrated: 15
The generated text is ['p', '1', '1', 'u', 'h', 'w',
The most common letter is p with 2 times
**Sample run2**
Enter the length of the text to be genrated: 20
'y', 'k', 'c', 'r', 'k', 'h', '', 'r']
The generated text is ['p', '1', '1', 'u', 'h', 'w', 'p', 'y', 'k', 'c', '', 'k',
'1']
The most common letter is 1 with 3 times
**Sample run3**
Enter the length of the text to be genrated: 25
The generated text is I'p', '1', '1', 'u', 'h', 'w', 'p', 'y', 'k', 'c', 'r', 'k', 'h', 'v', '', 'c', 'e', '1', 'd',
'1', 'k', 'h', 'g', 'c','k']
The most common letter is k with 4 times
I
Transcribed Image Text:Question 2 Edit Metadata Given a list (characterList) containing the alphabet, write a Python program for randomly generating a list of n letters where n is input from the user. The program then shows the most common letter in the generated list and how many times it is repeated. If there is more than one most common letter with equal replication, you can select any one of them. The program should consist of three functions: generateList function to take 2 arguments; the character List and n as input and retum the generated list with length n mostCommonChar function to receive a list of charcaters and returns as a tuple the most common character and the number of its repetitions. ■ main function is to read the value of n and call generateList and mostCommonChar functions. alphabetList=["a","b","c", ","e","f". "g","h","","","K" HINT to compare your output with sample runs, use seed(50) Edit Metadata **Sample run1** Enter the length of the text to be genrated: 15 The generated text is ['p', '1', '1', 'u', 'h', 'w', The most common letter is p with 2 times **Sample run2** Enter the length of the text to be genrated: 20 'y', 'k', 'c', 'r', 'k', 'h', '', 'r'] The generated text is ['p', '1', '1', 'u', 'h', 'w', 'p', 'y', 'k', 'c', '', 'k', '1'] The most common letter is 1 with 3 times **Sample run3** Enter the length of the text to be genrated: 25 The generated text is I'p', '1', '1', 'u', 'h', 'w', 'p', 'y', 'k', 'c', 'r', 'k', 'h', 'v', '', 'c', 'e', '1', 'd', '1', 'k', 'h', 'g', 'c','k'] The most common letter is k with 4 times I
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education