Topics: User-defined functions, list, string, docstring Problem Statement: This program finds the unique letters from a given string and prints the unique letters and their count. For example: word ‘LITTLE’ has ‘L’, ‘I’, ‘T’, ‘E’ are the unique letters. Lab Scenario: The program repeats until hits ‘n’. The program takes a user input of a string. The program finds the unique letters in the string, add them in a list and displays the list and their count. Consider the following important points: 1) You need to design a user-defined function named count_unique_letters which takes user word as parameter and returns the list of unique letters called unique_letters in the given word. a. Hint: Iterate over each letter in user word, check if the letter is in the list, if not add it to the list, otherwise continue to the next letter. A ‘in’ keyword can help to determine if a character in the unique_letters list. b. You need to write a simple docstring for this function. 2) Your program must have a main() function. Function main() designs user menu, should take user input, call the count_unique_letters function and then prints the list returned by the function along with the count of unique letters. You need to consider using a for loop for printing the unique_letters list to get full points. a. No need to write docstring for main function b. Consider a while loop to take user word as long as user do not hit ‘n’. 3) A sample I/O is provided below. Submission: 1. All submission will be via BlackBoard during the lab time 2. Due is mentioned in the above. 3. You can take help from the GTA and have group discussion but cannot copy codes. 4. The codes need to be written in the firstname_lastname_LA6.py file. Please change the name of the file and the header of the file. Sample input/output: (Font color black indicates user input) Enter a word to start with : little little has following unique letters l--i--t--e— Count : 4 Do you want to continue (y/n): y Enter a word to start with : computer computer has following unique letters c--o--m--p--u--t--e--r— Count : 8 Do you want to continue (y/n): y Enter a word to start with : google google has following unique letters g--o--l--e— Count : 4 Do you want to continue (y/n): n >>>

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

Topics: User-defined functions, list, string, docstring
Problem Statement: This program finds the unique letters from a given string and prints
the unique letters and their count. For example: word ‘LITTLE’ has ‘L’, ‘I’, ‘T’, ‘E’ are the
unique letters.
Lab Scenario:
The program repeats until hits ‘n’. The program takes a user input of a string. The program
finds the unique letters in the string, add them in a list and displays the list and their count.
Consider the following important points:
1) You need to design a user-defined function named count_unique_letters which
takes user word as parameter and returns the list of unique letters called
unique_letters in the given word.
a. Hint: Iterate over each letter in user word, check if the letter is in the list, if not
add it to the list, otherwise continue to the next letter. A ‘in’ keyword can help
to determine if a character in the unique_letters list.
b. You need to write a simple docstring for this function.
2) Your program must have a main() function. Function main() designs user menu, should
take user input, call the count_unique_letters function and then prints the list
returned by the function along with the count of unique letters. You need to consider
using a for loop for printing the unique_letters list to get full points.
a. No need to write docstring for main function
b. Consider a while loop to take user word as long as user do not hit ‘n’.
3) A sample I/O is provided below.
Submission:
1. All submission will be via BlackBoard during the lab time
2. Due is mentioned in the above.
3. You can take help from the GTA and have group discussion but cannot copy codes.
4. The codes need to be written in the firstname_lastname_LA6.py file. Please change
the name of the file and the header of the file.
Sample input/output: (Font color black indicates user input)
Enter a word to start with : little
little has following unique letters
l--i--t--e—
Count : 4
Do you want to continue (y/n): y
Enter a word to start with : computer
computer has following unique letters
c--o--m--p--u--t--e--r—
Count : 8
Do you want to continue (y/n): y
Enter a word to start with : google
google has following unique letters
g--o--l--e—
Count : 4
Do you want to continue (y/n): n
>>>

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Similar 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