# AI News, Difference between revisions of "How to Think Like a Computer Scientist: Learning with Python 2nd Edition/Solutions"

## Difference between revisions of "How to Think Like a Computer Scientist: Learning with Python 2nd Edition/Solutions"

The following section contains answers to the exercises in the Book.

Why does a call to num_digits(-24) result in an infinite loop (hint: -1/10 evaluates to -1)?

The loop will end when n = 0, and per above -1/10 == -1, causing an infinite loop.

Encapsulate: in a function named count_letters, and generalize it so that it accepts the string and the letter as arguments.

Now rewrite the count_letters function so that instead of traversing the string, it repeatedly calls find (the version from Optional parameters), with the optional third parameter to locate new occurences of the letter being counted.

ceil function finds the lowest integeral value greater than or equal to x.

deepcopy would have come handy in exercises you didn't have to solve regarding object reference, thus no answer is excpected here.

The word 'alice' occurs 386 times (not including 12 occurences of 'alice's')

Find Text in String With Excel SEARCH Function

The SEARCH function looks for a text string, within another text string. The SEARCH function ..

Algorithms in Python: Recursion -- Find Uppercase Letter in String

In this video, we want to solve the following problem: Given a string, develop an algorithm to return the first occurring uppercase letter. We require both an ...

IF Function with Partial Match on Text String or "Contains" Criteria

This video demonstrates how to test for a partial match on a text string in the context of an IF function. The solution uses the SEARCH and ISNUMBER functions ...

Excel: Find the Position of the First Letter in a Text String

The video explains how to use Excel to find the position of the alpha character in a text string. The formula generated in the video is: {=MATCH(TRUE ...

Microsoft Access Tutorial: String Functions (Left, Right, InStr, Trim)

In this Microsoft Access tutorial, I'll show you how to break up text fields into smaller parts using Left, Right, Trim, and InStr.

Return maximum occurring character in an input string | GeeksforGeeks

Find Complete Code at GeeksforGeeks Article: Practice Problem Online ..

IF Function with Multiple Partial Match Text String Criteria

This video demonstrates how to specify multiple partial text string match criteria in a logical test. For example does text contain X and Y. The solution uses the ...

Python Find String Method

Be sure to like, share and comment to show your support for our tutorials. ======================================= Channel - ..

Excel 2016 - Extract text string using LEFT, MID, RIGHT and FIND

In this video I show you how to extract specific text strings from within a cell using the Excel functions Left, Mid, Right, and Find.

Remove characters from a string using LEFT and RIGHT - Fix your data! (Excel tips #3)

Remove characters from a string using LEFT and RIGHT - Fix your data! (Excel tips #3) | Looking for a full training course on Excel? Go to Excel University ...