Metadata
Title
11A: Lower Case
Category
general
UUID
37d5473d92034ef48fb1f236461d30e8
Source URL
https://cscircles.cemc.uwaterloo.ca/11a-lower-case/
Parent URL
https://cscircles.cemc.uwaterloo.ca/
Crawl Time
2026-03-18T05:13:50+00:00
Rendered Raw Markdown

11A: Lower Case

Source: https://cscircles.cemc.uwaterloo.ca/11a-lower-case/ Parent: https://cscircles.cemc.uwaterloo.ca/

Lesson 11 has three parts A, B, C which can be completed in any order.

This lesson contains an exercise where you need to write two functions: one will use the other to accomplish its goal. The goal is to eventually write a function lowerString that can convert all of the letters in a string to lower case. (A, B, C are upper case letters and a, b, c are lower case.) For example, the result of

lowerString("This string has 9 CAPITAL letters (& Punctuation)!")

should be

"this string has 9 capital letters (& punctuation)!"

Step 1: Characters

The first step is to write a function lowerChar(char) that can return the result of converting a single character char to lower case. It should do the following:

(In order to do the first step, you will have to use an if statement, an and operator, and apply some knowledge from the lesson about strings.)

Coding Exercise: Lower-case Characters

Define a function lowerChar(char) which meets the above description.

You need to create an account and log in to ask a question.

delete this comment and enter your code here

Enter testing statements like print(myfunction("test argument")) below.

More actions... History Help

Step 2: Strings

Now, you will write a second function lowerString(string) which will return the result of converting the entire string to lower case, by calling lowerChar on each character. We suggest you do this as follows:

Coding Exercise: Lower-case Strings

Define a function lowerString(string) which returns the result of converting string to lower case.

You need to create an account and log in to ask a question.

first, copy your definition of lowerChar() here

then define lowerString(string)

Enter testing statements like print(myfunction("test argument")) below.

More actions... History Reset code to default Help

Later on, you will learn about the string.lower() method, which is a built-in way to perform this task.