CSC108H1 Lecture Notes - Lecture 9: Empty String

61 views2 pages
yifanyang and 39659 others unlocked
CSC108H1 Full Course Notes
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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents