Saint Louis University |
Computer Science 150
|
Dept. of Math & Computer Science |
All of these problems are for practice. You are freely encouraged to work together and you do not need to submit any of this work for a grade.
Practice 5.31 of the text
Write a function yesOrNo(prompt) that asks the user a
question with the given prompt, and demands a response of 'yes'
or 'no'. If any other response is received, an
appropriate reminder should be printed and then the user
should be reprompted unitl a legitimate response is received.
Return True if the eventual response is
'yes' and False if 'no'.
Exercise 5.35 of the text
This is a problem that asks for a robust error-checking of a
function toDecimal(value, base), in which the value
is expressed as a string, such as 'FAB4', and the
base is a positive integer that is at most 36. The function is
supposed to return the appropriate integer value.
To get you started, download this solution to the
earlier Exercise 5.26, which provides a valid
implementation of the base conversion, yet without any error-checking.