Skip to content

Instantly share code, notes, and snippets.

@samlandfried
Forked from mbburch/prework.md
Last active January 19, 2017 21:58
Show Gist options
  • Save samlandfried/3813cfa87b17d3aae895f0c152c93ee5 to your computer and use it in GitHub Desktop.
Save samlandfried/3813cfa87b17d3aae895f0c152c93ee5 to your computer and use it in GitHub Desktop.
Sam Landfried's prework

Turing School Prework

Task A- Practice Typing:

  • screenshots of scores will be posted in comments

Task B- Algorithmic Thinking & Logic:

  • screenshots of completed sections will be posted in comments

Task C- Create your Gist:

Task D- Set up your Environment:

  • Did you run into any issues?

Brew was unhappy with some previous installations of Node and a few other programs.

  • How do you open Atom from your Terminal?

I don't know, but "sublime" opens Sublime!

  • What is the file extension for a Ruby file?

.rb

  • What is the Atom shortcut for hiding/ showing your file tree view?

⌘K, B

  • What is the Atom shortcut for quickly finding a file (fuzzy finder)?

⌘P

Task E- The Command Line:

  • screenshots of your terminal after each exercise will be posted in comments

Day One Questions:

  • What does pwd stand for, and how is this command helpful?

Print working directory. It shows you where you are in the file system.

  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname?

It shows the name of the current host, which in my case is SAMUELs-MacBook-Pro.local

Task F- Learn Ruby:

Option 1 Questions:

IRB Completed day 2

  • How do you start and stop irb?

"irb" and "exit"

  • What might you use irb for?

determining what value a Ruby statement returns

Variables Completed day 2

  • How do you create a variable?

by typing a legal variable name, followed by the assignment operator, followed by the value

  • What did you learn about the rules for naming variables?

Variable names cannot start with a number or include a - symbol. There is a strange condition if the first letter is capitalized, but I'm not sure what happens.

  • How do you change the value of a variable?

By reassigning like you did upon variable creation.

Datatypes Day 3 completed

  • How can you find out the class of a variable?

With the .class method

  • What are two string methods?

.to_i .class

  • How can you change an integer to a string?

With the .to_s method

Strings Day 3 completed

  • Why might you use double quotes instead of single quotes in Ruby?

To create a string that includes single quotes, or to use interpolation

  • What is this used for in Ruby: #{}?

Interpolating values into a string. Ruby evaluates the Ruby code in the brackets.

  • How would you remove all the vowels from a string?

With the String.delete('aeiou') method

Input & Output Day 3 completed

  • What do 'print' and 'puts' do in Ruby?

They output a string. Every output from puts begins on a new line, but not so for strings. Both return nil.

  • What does 'gets' do in Ruby?

Gets takes input from the user.

  • Add a screenshot in the comments of the program you created that uses 'puts' and 'gets', and give it the title, "I/O".

Numbers & Arithmetic Day 4 completed

  • What is the difference between integers and floats?

Integers are whole numbers, floats are fractions

  • Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers".

Booleans Day 4 completed

  • What do each of the following symbols mean?

    • == equal to
    • = greater than or equal to

    • <= less than or equal to
    • != not equal to
    • && and
    • || or
  • What are two Ruby methods that return booleans?

.nil? .end_with?

Conditionals Day 5 completed

  • What is flow control?

It's a way of controlling what code is executed and when, based on conditions in the code

  • What will the following code return?
apple_count = 4

if apple_count > 5
  puts "Lots of apples!"
else
  puts 'Not many apples...'
end

I think "puts" doesn't return a value, so nothing. But it would print "Not many apples..."

  • What is an infinite loop, and how can you get out of one?

When a program enters a loop that will never end. You have to kill the program to exit one.

  • Take a screenshot of your program and terminal showing two different outputs, and post it in the comments with the title, "Conditionals".

nil Day 5 completed

  • What is nil?

A datatype that represents "nothing"

  • Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "nil".

Symbols

  • How can symbols be beneficial in Ruby?

They are an efficient way to store frequently referenced values.

  • Does naming symbols use the same rules for naming variables?

Yes, except they start with :

  • Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "Symbols".

Arrays

  • What method can you call to find out how many elements are in an array?

.length

  • What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]?

0

  • What do 'push' and 'pop' do?

Respectively, they add and remove an element to the end of the array.

Hashes

  • Describe some differences between arrays and hashes.

Hashes are collections of values attached to keys. Where arrays are organized based on a numerical index, hashes use strings to arrange their data.

  • What is a case when you might prefer an array? What is a case when you might prefer a hash?

Arrays are good for storing data where the "key" is irrelevant. Basically, anything that fits on a list would go well in an array. A collection of books, for example. Since the factors describing a book don't fit as well into a list, a hash is really a better way to store their data, because a key can clarify if the value is a title, an author, a blurb or whatever.

    • Take a screenshot of your terminal after working through Step 2, and post it in the comments with the title, "Hashes".

Task G- Prework Reflection:

  • Were you able to get through the work? Did you rush to finish, or take your time?

I've done everything except the empathetic programming responses. I'm on a bit of a time crunch, so I'm rushing. I will get to the empathetic programming articles and videos, because I do think that is interesting and valuable.

  • What are you most looking forward to learning more about?

Algorithms. The work on Brilliant was fun.

  • What topics would you most like to see reinforced by instructors?

Hm... I feel like the topics covered by this prework don't bear reinforcement beyond using them naturally. They weren't complicated.

  • What is most confusing to you about what you've learned?

Symbols. I think I understand why they'd be valuable, but I'm having trouble imagining a scenario where I'd use them.

  • What questions do you have for your student mentor or for your instructors?

Why are integers and floats separate classes? It seems like a single number class would be able to encapsulate both.

@samlandfried
Copy link
Author

samlandfried commented Jan 19, 2017

Day 4

Typing
screen shot 2017-01-18 at 7 21 24 pm

Algos
screen shot 2017-01-18 at 7 26 30 pm

CLI
screen shot 2017-01-18 at 7 34 30 pm

Numbers
screen shot 2017-01-18 at 8 01 26 pm

@samlandfried
Copy link
Author

samlandfried commented Jan 19, 2017

Day 5

Typing
screen shot 2017-01-19 at 1 20 35 pm

Conditionals
screen shot 2017-01-19 at 2 10 31 pm

Symbols
screen shot 2017-01-19 at 2 32 35 pm

Hashes
screen shot 2017-01-19 at 2 50 30 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment