Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am taking a CS course in college and I'm completely new to this, and I am so lost. I get the basics I just

I am taking a CS course in college and I'm completely new to this, and I am so lost. I get the basics I just have a hard time putting it all together. Please do #1 and #2 as if you're new, the code doesn't have to be complex/perfect, just so long as it gets me started in the right direction. thanks! image text in transcribed
Note: you may not use list comprehensions or similar Python constructs not taught yet in this course. You many not use dictionaries. See notes for individual problem for any additional constraints. 1. Write function modifyString(origString, chars To Replace, count) that takes as input a string origString, a string chars To Replace, and a positive integer count, and returns a new string such that each character in origString that occurs in chars ToReplace is replaced by n consecutive copies of that character (with the same case as in the original). For example, >>> modifyString("Our cat is funny.", "aeiou", 5) 00000uuuuur caaaaat iiiiis fuuuuunny. >>> modifyString("Our cat is funny.", "zu", 3) "Ouuur cat is fuuunny." 2. Write a function, 42(inputString, minLetter), that takes as input a string of letters and returns six things: the lexicographically smallest letter (UZ >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 'e' is the third smallest in 'ababde 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: >>> 42('aacyYcqyoQqyqe', 'b') ('c', 2, 'y', 3, 'q', 5) >>> 22 ['aacyYcqyooqyqe', 'I) ('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

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions

Question

13. Feel superior to other members?

Answered: 1 week ago