Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function, q1(inputString), that takes as input a string of letters and prints three things: the lexicographically largest largest letter (z/Z > y/Y >

Write a function, q1(inputString), that takes as input a string of letters and prints three things: the lexicographically largest largest letter (z/Z > y/Y > ... > a/A), the third largest letter, and the most common letter along with how many times that letter occurs. When printing the largest and third largest and most common letters, the output can be either lower or upper case so long as the letter appears at least once with that case in the input string. You may not assume that the input string contains at least three different characters (or even any characters at all). Make sure to recognize various situations where fewer than three different letters appear in the string and print something appropriate for those situations. If two or more letters tie for most common, you may choose any one of them. For example:

>>> q1('aacyYcqyQQqyqc') In 'aacyYcqyQQqyqc', the largest letter is 'y', the third largest letter is 'c', and the most common letter is 'q', occurring 5 times >>> q1("bBBbAb") In 'bBBbAb', the largest letter is 'b', there is no third largest letter, and the most common letter is 'b', occurring 5 times 

NOTE: you may not use built-in min, max, sort, or sorted functions (you should also not write your own sorting method). You may not use any built-in string methods (other than .lower()). You may use [] to access single characters of a string, if you wish. 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

Big Data 29th British National Conference On Databases Bncod 2013 Oxford Uk July 2013 Proceedings Lncs 7968

Authors: Dan Olteanu ,Georg Gottlob ,Christian Schallhart

2013th Edition

3642394663, 978-3642394669

More Books

Students also viewed these Databases questions

Question

In Problems 916, solve each triangle. 2 45 C 4 b A

Answered: 1 week ago

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago