The assignments listed here should take you approximately 60 minutes.
To start this assignment, click the button in the upper right-hand corner that says Fork. This is now your copy of the document. Click the Edit button when you're ready to start adding your answers. To save your work, click the green button in the bottom right-hand corner. You can always come back and re-edit your gist.
Markdown is the format all of your homework gists are written in.
Using this markdown cheatsheet, create a new gist of your own by clicking the New Gist button in the upper right-hand corner of the screen. Create a "Beginners Guide to data types" documenting your data types knowledge so far using Markdown.
NOTE: Remember to add a .md file extension to filename of your new Gist. Otherwise it will not register as markdown.
Incorporate each of the following features into your Gist:
-
at least two headings of different sizes
-
at least one numbered list
-
at least one bullet point list
-
at least one bold word/phrase
-
at least one italic word/phrase
-
at least one code block
-
at least one inline code block (greyed text)
-
at least one image
-
Paste the link to your gist here: I'm a link
Documentation of a language, framework, or tool is the information that describes its functionality. For this part of the practice tasks, you're going to practice digging into documentation and other reference material.
NOTE: Remember to look for the docs! mdn for javascript and ruby-doc for ruby.
- In your own words, what does the JavaScript/Ruby string split method do (pick based on your program)? As you're explaining, be sure to provide an example. Your answer: String split method manipulates a sequence of objects in an array, based on a given parameter. String split divides the string into subsets. For example, a string "cat" can be split into a subset of strings "c", "a", and "t", or "ca", "t".
str = "cat"
print str.split(" ")
# result
"c", "a", "t"
-
What did you Google to help you with this task, and how did you pick your results? I typed "split string Ruby" into a google search and checked out several pages, focusing mostly on the ones recommended by instructors in Session 1.
-
In your own words, what does the JavaScript/Ruby array slice method do (pick based on your program)? As you're explaining, be sure to provide an example. Your answer: Array slice method returns a value of a specific item in an array. For example, if we have an array of fruit slices, we can pick a slice of a particular fruit by giving a certain value. The value will return a requested object from the array.
fruit = ["apple", "banana", "orange", "grapefruit", "tomato"]
fruit[2] = orange
fruit.slice(2)
orange
- What did you Google to help you with this task, and how did you pick your results? I searched "Array slice Ruby" and read through several pages. Some made no sense, others used better examples that I was able to visualize. I picked the ones that were easier to understand.
Imagine that you're taking your favorite board game and turning it into a computer-based game.
-
Name of board game:
Risk -
Use the space below to categorize game data into each of the following data types. You should have a minimum of two variables assigned for each data type below. Feel free to break each variable declaration on to its own line. Pick either ruby or javascript based on your program (see examples below for how they should look)
- String data:
ruby example:
player_name = 'David'
javascript example:
var gamePiece = 'Old wooden ship';
- Integer and/or float data:
- Boolean data:
- Array data:
- OPTIONAL: Hash or Object data:
String
game_name = "Risk"
game_goal = "Take over all the continents"
Array
territory = ["Europe", "Australia", "America", "Russia"]
player = ["David", "Alexis", "Moira"]
Integer
army_soldier = 15
army_cannon = 6
army_horse = 10
Boolean
player_1_turn = true
end_game = false
If you have any questions, comments, or confusions from the any of the readings that you would like an instructor to address, list them below:
- No questions, homework took a lot longer than expected
@dancinngcats - Nice work on this assignment. Looks like you got in some good practice in your Beginner's guide to data types gist, and your explanations of the string split and array slice methods were thorough. One suggestion for the examples is to break those out into their own code blocks and showcase how you would use those split and slice methods in code.
Your variable assignment work for the third task is missing examples of string data. Could you add those in and let me know once updated? Thanks!