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
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
Related questions
Question
Alert dont submit
![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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb6846349-33a4-4de1-889a-d07f802d1ce3%2F5f2a4c37-f9bb-4180-b932-f5c9f4aa687a%2F4p1jrvi_processed.png&w=3840&q=75)
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
Unlock instant AI solutions
Tap the button
to generate a solution
Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education