Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

All of question two. You can only use simple 'for' and 'while' loops as well as only simple comparison operators only. You can use [

All of question two. You can only use simple 'for' and 'while' loops as well as only simple comparison operators only. You can use [ ] to access single characters of a string. You cannot use built in min, max, or sorted functions (you shouldn't write your own sorting method). No string methods besides .lower(). No lists, dictionaries, or the ord() function. Thank you!
image text in transcribed
Programming language to be in Python 3
2. Write a function, 42(inputString, minLetter), that takes as input a string of letters and returns six things: the lexicographically smallest letter (zZ>y/Y> ... >a/A) greater or equal to minLetter, the smallest index at which that letter occurs, the third smallest letter greater than minLetter, the smallest index at which that letter occurs, the most common letter, and how many times the most common letter occurs. The third smallest letter must be distinct from the second smallest which must be distinct from the smallest. E.g. 'b' is the second smallest and 'c' is the third smallest in 'ababdc' Ignore case during computation. E.g. 'z' and 'Z' are considered the same letter. Use lower case when returning letters. Return None for smallest and thirdSmallest letters and corresponding indices when appropriate. 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 where there is no third smallest or smallest greater than minLetter. If two or more letters tie for most common, return the lexicographically smallest one. For example: >>> q2('aacyYcqyQQqyqc', 'b') ('c', 2, 'y', 3, 'q', 5) >>> 92('aacyYcqyQQqyqc', 'r') ('y', 3, None, None, 'q', 5) IMPORTANT NOTE: Use one or more simple loops, and simple comparison (,=, !=) operators only. You may use [] to access single characters of a string. 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 not use lists or dictionaries or the ord function

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

25 Vba Macros For Data Analysis In Microsoft Excel

Authors: Klemens Nguyen

1st Edition

B0CNSXYMTC, 979-8868455629

More Books

Students also viewed these Databases questions