Skip to content

Instantly share code, notes, and snippets.

@scmountain
Forked from mbburch/prework.md
Last active November 27, 2016 02:06
Show Gist options
  • Save scmountain/5e6a621097fe0867df5e15c17675b193 to your computer and use it in GitHub Desktop.
Save scmountain/5e6a621097fe0867df5e15c17675b193 to your computer and use it in GitHub Desktop.
Turing pre-work Gist

Turing School Prework- Spencer Carter

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: completed

Task D- Set up your Environment: completed

Task E- The Command Line: completed

Day One Questions:

  • What does pwd stand for, and how is this command helpful? present working directory, lets you know what file youre currenty working in. Extremely helpful to make sure you are working in the right directory!
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname? tells you the machines name. spencers-MacBook-Pro.local

Task F- Learn Ruby:

Option 1 Questions:

IRB

  • How do you start and stop irb? type "irb" into terminal to start, "exit" to exit back to terminal (Ctrl+D)
  • What might you use irb for? Irb looks like a great place for " oh yea, huh!" moments. Meaning when you need to check a small snippet of code to see if youre doing it right, and see how Ruby will run it. Also great way to iron out syntax that is not working.

Variables

  • How do you create a variable? you must define it first. only one "="
  • What did you learn about the rules for naming variables? No dashes, spaces, or periods; only leters and numbers.
  • How do you change the value of a variable? By redefining it, or manipulating it with other variables, this however will not save as the new variable value.

Datatypes

  • How can you find out the class of a variable? by typing .class after the variable
  • What are two string methods? : chomp! and : scrub
  • How can you change an integer to a string? 5555.to_s

Strings

  • Why might you use double quotes instead of single quotes in Ruby?
  • What is this used for in Ruby: #{}? String iterpolation, allows you to embed another ruby statement into a string. much like calling upon a variable.
  • How would you remove all the vowels from a string? "agjhfdilkjeshdflkg".delete'aeiou'

Input & Output

  • What do 'print' and 'puts' do in Ruby? Puts will make a new line, repeat the string, and give the value of the string "nil." Print will just repeat the string on the same line.
  • What does 'gets' do in Ruby? Get string, pauses the program to get a string from the user, it then repeats that string and resumes the program.
  • 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? Intergers are whole numbers, Floats are decimals AND will not be trunicated by Ruby when calculating.
  • Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers". COMPLETE

Booleans

  • What do each of the following symbols mean?
    • == : equals
    • = : greater than or eaqual to

    • <= : less than or equal to
    • != : opposite of
    • && : and
    • || : or
  • What are two Ruby methods that return booleans? : .ends_with? .empty?

Conditionals

  • What is flow control? flow control is where you have the program do work for you that is set in designated parameters
  • 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 you forget to set an ending(false) point for the loop. "Ctrl +C" gets you out of it.
  • 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 allows a variable to be left as 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? allow you to speed up the program from hogging memory. (calendar example)
  • Does naming symbols use the same rules for naming variables? No, cannot lead with numbers
  • 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 an element to the end of an existing array, 'pop' removes the last element (also returns the element)

Hashes

  • Describe some differences between arrays and hashes. Hashes use keys and values, a bit more initial typing, but eaiser to remember how to access each value. Arrays are more of a list, easier to type, but must remember each location of each item.
  • What is a case when you might prefer an array? What is a case when you might prefer a hash? Hashes are better for bigger lists, an array is better for smaller lists.
    • 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? For one week, I was able to work through it all at a moderate pace. I tried not to rush to make sure I wasnt just repeating the instructions, but understanding what each line was doing and why.

  • What are you most looking forward to learning more about? The concept of how programs work with the hardware is very interesting. much like symbols saving RAM usage

  • What topics would you most like to see reinforced by instructors? foundations, the "fancy frils" are fun, but solid fondations needs to be hammered home!

  • What is most confusing to you about what you've learned? The vernacular of coding. When reading ands and ands and & and more && etc etc

  • What questions do you have for your student mentor or for your instructors? how to know what method to use and when? I understand this is a matter of time, but overwhelmed by them so far.

@scmountain
Copy link
Author

scmountain commented Nov 21, 2016

Task E
screen shot 2016-11-21 at 4 27 50 pm

@scmountain
Copy link
Author

scmountain commented Nov 24, 2016

Task F: I/O
screen shot 2016-11-24 at 10 05 08 am

@scmountain
Copy link
Author

scmountain commented Nov 25, 2016

Task F: Numbers
screen shot 2016-11-25 at 12 17 11 pm

@scmountain
Copy link
Author

Task F: conditionals
screen shot 2016-11-25 at 6 07 05 pm

@scmountain
Copy link
Author

Task F: nil
screen shot 2016-11-26 at 5 54 04 pm

@scmountain
Copy link
Author

Task F: Symbols
screen shot 2016-11-26 at 6 17 29 pm

@scmountain
Copy link
Author

task F: Hashes
screen shot 2016-11-26 at 6 57 30 pm

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