Exam 2- 2013

Double letters or characters are 2 or more adjacent

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: s the letter Q (uppercase or lowercase), and False otherwise. CS 115 Exam 2, Spring 2013 Page 5 of 9 (c) Define a function called first_double that… • has one input parameter: a string • returns the first double letter (or character) in the string, or returns the empty string if there are no double letters. Double letters (or characters) are 2 or more adjacent, identical characters. Here are some examples: • If the string is "bubble", the function should return "b". • If the string is "bookkeeper", the function should return "o" (since the ‘o’ is the first double letter). • If the string is "fuzZy", the function should return an empty string. That is, the z/Z pair do not count as double letters. • If the string is "sucCess", the function should return "s". That is, it should ignore the mismatched c/C pair and consider the "s" to be the first double letter. CS 115 Exam 2, Spring 2013 Page 6 of 9 (d) Define a function called count_letter that… • has two input parameters: a string and a character • returns the number of times the...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online