Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(FOR PYTHON) Write a function, printStringStats(inputString), that takes as input a string of lowercase letters and prints three things: the lexicographically largest letter (z >

(FOR PYTHON) Write a function, printStringStats(inputString), that takes as input a string of lowercase letters and prints three things: the lexicographically largest letter (z > y > ... > a), the third largest letter, and the most common letter along with how many times it occurs. You may assume the string is at least one character long. But you may not assume that it contains at least three different characters. If fewer than three different letters appear in the string, print something appropriate for the third largest (e.g. "There is no third largest letter.") If two or more letters tie for most common, you may choose any one of them. For example:

>>> printStringStats('aaczzcqzqqqzqc') In 'aaczzcqzqqqzqc', the largest letter is 'z', the third largest letter is 'c', and the most common letter is 'q', occurring 5 times >>> printStringStats("aaaaba") In 'aaaaba', the largest letter is 'b', there is no third largest letter, and the most common letter is 'a', occurring 5 times 

NOTE: you may not use built-in min, max, sort, or sorted functions. You may not use any built-in string methods. Use one or more simple loops, and simple comparison (<,>, ==, !=) operators only.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions

Question

12 How reliable is a CFS?

Answered: 1 week ago

Question

How prepared was the organization for the new business strategy?

Answered: 1 week ago

Question

=+ 4. Why should policymakers think about incentives?

Answered: 1 week ago

Question

=+ 2. What is the opportunity cost of seeing a movie?

Answered: 1 week ago

Question

=+ what roles should government play in them ?

Answered: 1 week ago