# 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')

BluePrism - String Reg Expressions || Reality & Useful

Hi Friends, Now we will discuss about 'Utility - String' Regular expressions -------------------------------------------------------------------------- Why we need to use regular ...

Find Special Character in a string using Sql

In this video we learn how to find the special character , number in a string using sql server. -- How to Find Number and character in a string SELECT ...

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.

Extract Text from cells in Excel - How to get any word from a cell in Excel

More help: Excel Forum: This tutorial shows you how to input a formula into a .

04 C | How to count word in a string

In this video we will learn to count words using C programming language. The concept is really simple and you can try it out on your favorite programming ...

SPSSisFun: Converting Text (string) data to Numeric data

In this video I show you how to convert text data into numeric data. If you have any questions please feel free to post them in the comments section below and I ...

Counting Word Frequency using a Dictionary (Chapter 9)

- Python for Everybody: Exploring Data in Python 3.0 Please visit the web site to access a free textbook, free supporting materials, as well ..

Character frequency in a String using Java

Finding out how many times each individual character appears in a string using Java language. Note:"I meant to say 'j' at 7:58 ."

Changing a Numeric Variable to Categorical Variable in R (R Tutorial 5.4)

Learn how to create a categorical variable (a factor or qualitative variable) from a numeric variable in R using the "cut" command. In this video you will also learn ...

Python Count String Method

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