Skip to content

Instantly share code, notes, and snippets.

@livecodelife
Forked from mbburch/prework.md
Last active May 8, 2016 16:03
Show Gist options
  • Save livecodelife/a62a82484959edaadd287174931c0cfd to your computer and use it in GitHub Desktop.
Save livecodelife/a62a82484959edaadd287174931c0cfd to your computer and use it in GitHub Desktop.
Prework

Turing School Prework-Caleb Cowen

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? No trouble installing or running any programs. It did take a moment to figure out how to use the "ls" command to see files in my terminal and also to use "seeing is believing"
  • How do you open Atom from your Terminal? Use the command "atom ."
  • What is the file extension for a Ruby file? .rb
  • What is the Atom shortcut for hiding/ showing your file tree view? command\
  • What is the Atom shortcut for quickly finding a file (fuzzy finder)? commandT

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? present working directory. Lets you know which directory you are currently in
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname? The name of your computer. Calebs-MBP

Task F- Learn Ruby:

Option 1 Questions:

IRB

  • How do you start and stop irb? type "irb" in the terminal. Type "exit" to stop irb
  • What might you use irb for? To find out how certain language features work and to possibly write short programs

Variables

  • How do you create a variable? type "name of variable = value of variable" into the text editor
  • What did you learn about the rules for naming variables? To name the variable you place the name you wish to use before the "=". E.g. "nineteen = 19". Also, if the variable is made in the terminal in irb, as opposed to the text editor, the values of any variables containing letters must be written in "quotations" in order for irb to accept it
  • How do you change the value of a variable? By changing the value of the variable after the "=". E.g. "nineteen = 18"

Datatypes

  • How can you find out the class of a variable? By entering ".class" after the variable
  • What are two string methods? ".upcase" and ".downcase"
  • How can you change an integer to a string? .to_s

Strings

  • Why might you use double quotes instead of single quotes in Ruby? In order to use string interpolation and embed a Ruby statement in your string
  • What is this used for in Ruby: #{}? Embedding a Ruby statement
  • How would you remove all the vowels from a string? 'string'.delete(aeiou)

Input & Output

  • What do 'print' and 'puts' do in Ruby? Puts writes a line and makes a new empty line after it. Print does the same without making a new line.
  • What does 'gets' do in Ruby? Pauses the program and waits for the user to type something then hit enter
  • 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

  • What is the difference between integers and floats? Integers are whole numbers. Floats are decimals numbers
  • Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers".

Booleans

  • What do each of the following symbols mean?
    • == Equal
    • = Equal or greater than

    • <= Equal or less than
    • != Not equal
    • && and
    • || or
  • What are two Ruby methods that return booleans? ".end_with" and ".include"

Conditionals

  • What is flow control? Making the program make decisions for you by selectively executing code based on values in the system
  • What will the following code return? 'Not many apples...'
apple_count = 4

if apple_count > 5
  puts "Lots of apples!"
else
  puts 'Not many apples...'
end
  • What is an infinite loop, and how can you get out of one? When the loop body doesn't do anything to make the "while" condition false, causing the program to repeat the same response without end. You can terminate the program with "ctrl + c"
  • Take a screenshot of your program and terminal showing two different outputs, and post it in the comments with the title, "Conditionals".

nil

  • What is nil? Nil means nothing or that a variable hasn't been assigned anything yet, or that a finction doesn't return a value
  • 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?
  • Does naming symbols use the same rules for naming variables?
  • 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? "push" adds a new element to the end of the array. "pop" removes and returns the element at the end of the array

Hashes

  • Describe some differences between arrays and hashes. Elements in array are accessed by their position. Elements in a hash are accessed by name or key
  • What is a case when you might prefer an array? What is a case when you might prefer a hash? Arrays are useful for working with a large group of similat items. Hashes are useful for storing the properties of an object
    • Take a screenshot of your terminal after working through Step 2, and post it in the comments with the title, "Hashes".
@livecodelife
Copy link
Author

Task E- Screenshot of "pushd" and "popd" exercises
screen shot 2016-04-30 at 1 59 49 pm

@livecodelife
Copy link
Author

Task F- "Numbers
screen shot 2016-04-30 at 2 20 17 pm

@livecodelife
Copy link
Author

Task F - "Conditionals
screen shot 2016-05-01 at 11 59 09 am

@livecodelife
Copy link
Author

Task A- Screenshot of typing lesson
screen shot 2016-05-01 at 12 09 50 pm

@livecodelife
Copy link
Author

Task E-Screenshot of "cd" exercise
screen shot 2016-05-01 at 12 22 47 pm

@livecodelife
Copy link
Author

Task E-Screenshot of "cp" exercise
screen shot 2016-05-01 at 12 38 09 pm

@livecodelife
Copy link
Author

Task E- Screenshot of "mv" exercise
screen shot 2016-05-01 at 12 46 47 pm

@livecodelife
Copy link
Author

Task F- "nil"
screen shot 2016-05-01 at 1 02 30 pm

@livecodelife
Copy link
Author

Task F-Symbols
screen shot 2016-05-01 at 1 31 49 pm
screen shot 2016-05-01 at 1 31 53 pm

@livecodelife
Copy link
Author

Task F- "Hashes'
screen shot 2016-05-01 at 2 37 03 pm

@livecodelife
Copy link
Author

Task A- Screenshot of typing lesson
screen shot 2016-05-02 at 6 03 12 pm

@livecodelife
Copy link
Author

Task A- Screenshot of typing lesson
screen shot 2016-05-03 at 9 36 04 am

@livecodelife
Copy link
Author

Task A- Screenshot of typing lesson
screen shot 2016-05-05 at 5 56 28 pm

@livecodelife
Copy link
Author

Task A- Screenshot of typing lesson
screen shot 2016-05-07 at 11 58 22 pm

@livecodelife
Copy link
Author

Task A-Screenshot of typing lesson
screen shot 2016-05-08 at 10 02 54 am

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