CSC321.01 2017S, Class 02: Getting Started with Ruby
Overview
- Preliminaries.
- Admin.
- Upcoming Work.
- Questions.
- Ruby
- Some Ruby Problems
Preliminaries
Admin
Notes
- We now have a schedule in place. The rest of the syllabus should be there tonight.
- I lied. Most students last year said they took 4-5 hours. That means I’ve used about half of your homework time for this week (assuming that you got through everything).
- How long did the Ruby thing take?
Homework
- More Ruby (soon to appear in assignments)
- Reading journal (in assignments)
Good Things To Do
Note
Questions
Ruby
What’s something familiar?
What’s something new and exciting you’ve discovered about Ruby?
How does Ruby handle a programmer’s need for multiple inheritance?
What is something particularly confusing or puzzling in the Codecademy tutorial?
Other comments …
Some Ruby Problems
We did not get to this section. You are likely to do it in homework.
Write sums_to_n?(vals,val) that returns true if any two distinct
values from vals (a list of values) sums to val.
sums_to_n?([1,2,7],5)-> falsesums_to_n?([1,2,7],3)-> truesums_to_n?([1,2,7],8)-> truesums_to_n?([1,2,7],9)-> truesums_to_n?([1,2,7],4)-> false
Write multiple_of_4?(bitstring) that takes a string of 0’s and 1’s
(representing an unsigned integer) as input and returns true if the
string represents an integer divisible by four.
Write starts_with_consonant?(str) that determines if a string
starts with a consonant.