CSC108H1 Lecture Notes - Lecture 9: Empty String
yifanyang and 39659 others unlocked
21
CSC108H1 Full Course Notes
Verified Note
21 documents
Document Summary
An empty string is returned because starting at 0, and moving by -1 yields no results since 0 is already furthest left of the indices. To return a string with characters in reverse, make the starting value the length of the string. Return true if age represents a teenager between the ages of 13 and. 18 return 13 <= age <= 18 (inclusive) The numbers 13 and 18 are known as magic numbers. We can store the numbers 13 and 18 as constants. Min_teen_age = 13 and max_teen_age = 18. The constants should be assigned before the function. Return true if age represents a teenager between the ages of 13 and (inclusive) Constant names makes statements easier to understand at first glance. They also make it easier to change values, since values must only be changed in one place. The code will still work exactly the same way.