X
#
Welcome to the Basic Prep!

These free mini-courses will give you a strong foundation in web development. Track your progress and access advanced courses on HTML/CSS, Ruby and JavaScript for free inside our student portal.

Scroll down...

You should have a pretty good handle on the basics of using Ruby by now, though you may feel unsure of all the different methods that are available to you and when to use them. We promise that you'll only actually end up using a handful of them in the real world so it won't be nearly as confusing later on.

For this assignment, we want to make sure you really understand Ruby and give you a chance to solve some problems with it on your own. The first section will have you go through an existing resource which is laid out with a series of small challenges and then the second part will have you solving some trickier (and classic) problems on your own.

The last introductory-level assignment for you is to conquer the Ruby Monk's Introduction to Ruby. This is a fairly comprehensive and fast-moving course. Some of it will overlap what you already know and other parts may surprise you. If you're totally comfortable with Ruby by now, you can skip it.

**Do the Ruby Monk Primer**. They will basically teach you something and then expect you to run a bit of code to make it happen. It takes a bit of getting used to where you're supposed to type your answers and how to run them.

**Note**: Ruby Monk is currently unavailable and can be accessed from this archived version for the time being.

Project Euler is a site containing a series of increasingly difficult programming problems. Many of the later ones are designed to be solved algorithmically instead of using a brute force method (some of them would take your computer 100 years to finish if you didn't find the "sneaky" way to solve it). The early ones, though, are great exercises for practicing to use Ruby for solving problems.

Some of these will require you to dust off a bit of math but if you're too lost in thinking mathematically, you're probably not doing it right -- let the computer do all the work for you and just use iteration and conditional logic to your advantage. This is a good test of "Can you find the simplest, dumbest possible solution or will you try to out-think the problem?" Remember KISS (Keep It Simple Stupid) is one of the principles of software engineering!

Write your solutions to the following problems in a `.rb`

file and run it from the command line (Remember how? Does `$ ruby ./yourfilename.rb`

sound familiar?):

- Problem 1: Multiples of 3 and 5
- Problem 2: Even Fibonacci Numbers
- Problem 3: Largest Prime Factor (Don't bother for numbers over 100,000 when using the brute force solution or you'll need a few days to calculate...)
- Problem 4: Largest Palindromic Product. For this one, make sure you're using the brute force solution! You'll want to figure out how to check whether a number is "palindromic" and then iterate through all 3 digit number products looking for the largest one.
*Hint: Start with the big ones and go backwards!*

- John Popenuck's solution
- Allen Anderson's Solutions:

There are ( ) additional resources for this lesson. Check them out!