Fizz Buzz success!~

So prior to gaining entry to The Firehose Project, they have me working on 3 prework assignments (1 HTML/CSS challenge where you make a splash website, and 2 Ruby challenges). I had the HTML/CSS assignment on lock because of my experience in a Web Design course and Moorpark, but I had no experience in Ruby whatsoever.

But it’s not like they threw me to the wolves with nothing at all, they did have me do 32 exercises from Learn Ruby The Hard Way. This helped me gain a small set of tools which would help me with the 2 Ruby challenges.

The first was a temperature conversion program, where the program would ask for an input of Celsius, which would then spit out the Fahrenheit conversion. I went a little bit further and did the bonus challenge, which asks which conversion would you like to do first, instead of doing just Celsius.

The second of the 2 Ruby challenges was a bit more complex. The program would take a number, and starting from 0, it would count up to that number. As it counts down, if the number divisible by 3, it would take that number and replace it with a “Fizz”. If the number is divisible by a 5, it would take that number and replace it with a “Buzz”. And if it is a number that is divisible by both 3 and 5, it would then replace the number with “FizzBuzz”.

On my first try, I was able to get the input, and then print out the range. But from there on, I was having issues with my if-statements and getting the “Fizz” and “Buzz” to convert. I didn’t even bother with “FizzBuzz” at the moment. I had hit a wall, and I was thinking over and over what I was doing wrong. Because the exercises assigned were from 1 – 32 (Learn Ruby The Hard Way), I kept trying without going ahead.

I then got in contact with Marco, who started to set me up with getting on the platform of The Firehose Project. I then asked if I could go forward in the book in case I could find more clarity about how to go about and solve this, which he then approved. And with that, in the next chapter, I was able to find what I was looking for using while-loops. I’m sure there is a way with the 32 exercises prior and so I’m probably not understanding fully, but with the while-loops, I was able to get the results I was looking for.

ch_02My advice: Never give up. Take a break if you have to but don’t full out toss it to the side and just look for the answers online. This is a question that is often asked in job interviews, and at one point 95% of those being interviewed couldn’t answer it. You’re going to want to know how to do it for yourself, and on top of that, it feels so rewarding to know that you were able to figure out this puzzle.

A technical word of advice is to write it all on paper. When you type things out, you can’t really organize as you would in a mind map. From what I’ve experienced so far and what I expect to see, I am predicting there will be ALOT of nesting, so you better learn how to group and organize early.

Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes. Want to know something scary? The majority of comp sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

Now, I’m just waiting on a reply and hopefully that’s all the prework that needs to be done and we can get this started. I’ll probably read through the rest of the Learn Ruby the Hard Way exercises until then. And play Rift, lol.



One thought on “Fizz Buzz success!~

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s