3. Implement q3(inputString, minLetter, lettersTolgnore, specialLetter) so that it returns three things: the smallest letter in inputString that is both greater than minLetter and not in lettersTolgnore, or None if no such letter exists the highest index at which that smallest letter occurs, or None if such a letter does not exist True if specialLetter occurs an odd number of times in inputString, False

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

Python Help me please

3. Implement q3(inputString, minLetter, lettersTolIgnore, specialLetter) so that
it returns three things:
the smallest letter in inputString that is both greater than minLetter and
not in lettersTolgnore, or None if no such letter exists
the highest index at which that smallest letter occurs, or None if such a
letter does not exist
True if specialLetter occurs an odd number of times in inputString, False
otherwise
inputString is a string a zero or more lower case letters, minLetter is a lower
case letter, lettersTolgnore is a string of zero or more lower case letters, and
special letter is a lower case letter NOT in lettersTolgnore. Use a simple while
loop. You may not use any string methods (such as .count()), but you may use
the 'in' or 'not in' operators.
E.g.
>>> q3("bссacbd", "a", "eb", "z")
('c', 4, False)
>>> q3 ("bccacbd", "a", "aefg", "d")
('b', 5, True)
>>> q3 ("abc", "d",
(None, None, True)
>>> q3 ("aaabac", "d", "", "a")
(None, None, False)
",
"a")
Remember, as in HW1, to return three values, simply list them in the return
statement with a comma separating each. E.g. return (smallestLetter,
indexOfSmallestLetter, speciallsOddlyThere) or return smallestLetter,
indexOfSmallestLetter, specialIsOddlyThere
Transcribed Image Text:3. Implement q3(inputString, minLetter, lettersTolIgnore, specialLetter) so that it returns three things: the smallest letter in inputString that is both greater than minLetter and not in lettersTolgnore, or None if no such letter exists the highest index at which that smallest letter occurs, or None if such a letter does not exist True if specialLetter occurs an odd number of times in inputString, False otherwise inputString is a string a zero or more lower case letters, minLetter is a lower case letter, lettersTolgnore is a string of zero or more lower case letters, and special letter is a lower case letter NOT in lettersTolgnore. Use a simple while loop. You may not use any string methods (such as .count()), but you may use the 'in' or 'not in' operators. E.g. >>> q3("bссacbd", "a", "eb", "z") ('c', 4, False) >>> q3 ("bccacbd", "a", "aefg", "d") ('b', 5, True) >>> q3 ("abc", "d", (None, None, True) >>> q3 ("aaabac", "d", "", "a") (None, None, False) ", "a") Remember, as in HW1, to return three values, simply list them in the return statement with a comma separating each. E.g. return (smallestLetter, indexOfSmallestLetter, speciallsOddlyThere) or return smallestLetter, indexOfSmallestLetter, specialIsOddlyThere
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

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