The assignments listed here should take you approximately 2 hours.
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.
Documentation of a langauge, 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: The linked documentation for each question below is a good starting place, but you should also be practicing your Googling skills and sifting through the results to find relevant and helpful sites.
-
In your own words, what does the Ruby array drop method do? As you're explaining, be sure to provide an example. Your answer: The Ruby array drop, drops an element from an array and then returns the array as it would be without the element that was dropped. ex: a=[1,2,3,4,5] a.drop(3) #=>[4,5]
-
What did you Google to help you with this task, and how did you pick your results? Google helped me find results relating to examples of this problem and I picked my result becuase i t was the most clear of what I could find. Unfortunately I am not sure I still fully understand this concept. I do not understand why it drops the numbers below 3 and despite me trying to google this I could not find a productive answer it a sensible amount of time.
-
In your own words, what does the Ruby array push method do? As you're explaining, be sure to provide an example. Your answer: Ruby Array -push- pushes whatever information you have under push to the end of your existing array. ex: B= ["C", "D", "E"] B.push( "F", "G", "H") #=> [ "C", "D", "E", "F", "G", "H"] or [5,6,7].push(8).push(9) #=> [5,6,7,8,9]
-
What did you Google to help you with this task, and how did you pick your results? At first I googled "Ruby Array Push" and searched through the results in different tabs and had no idea what I was looking at. Then I googled "Understaing Ruby Array Push" and still found myself more confused. So to ensure I was at least baseline fluent in arrays I reviewed all of the Mod 0 Session 2 work and that helped me understand just basic arrays better. I looked at the link under "push" and extrapolated my own understanding of this. In writing my answer I realized that I could not put ["1", "2", "3"] in an array via the "string" method because they are integers which do not need "" and can be written as a list with commas. I am still not sure I understand this completely becuase I feel like my fluency is not there enough to understand these basic concepts but as I keep staring and trying to understand I feel I am making /slight/ headway.
-
In your own words, what does the Ruby string split method do? As you're explaining, be sure to provide an example. Your answer: A Ruby string - split- allows you to take one line of string and split it into substrings. I would guess that this can save you time. ex:"all together now".split #=> [ "all" "together" "now" ]
-
What did you Google to help you with this task, and how did you pick your results? First I googled "delimiter programming ruby" I found an article titled "Splitting strings in Ruby" from 2018 so I opened it and read through that. I ended up bookmarking that page as it also had good examples. Then I simply googled "What is a delimeter" and found the wiki page to help me better understand what a delimeter is.
-
In your own words, what does the JavaScript array slice method do? As you're explaining, be sure to provide an example. Your answer: The JavaScript array -slice- method listens to your commands and will read your original array and then turn out another array that reflects the commands given. Ex: Var color = ['red', 'oarnge', 'yellow','green','blue','indigo']; console.log(animals.slice(3)); // expected output : Array [ 'green','blue','indigo'];
-
What did you Google to help you with this task, and how did you pick your results? I googes "JavaScript Array Slice" and opened up the results. The best page that I knew was more than likely reputable was a w3schools page and the article was really helpful.
-
In your own words, what does the JavaScript object values method do? As you're explaining, be sure to provide an example. Your answer: Javascript Object values take an array of different values and terms them into an array with the correct syntax for the different values. Ex: const object2 = { a:"Over" b:9000 c: true };
console.log(Object.values(object2));
//expected output ==> Array ["Over", 9000, True]
- What did you Google to help you with this task, and how did you pick your results? I started with "javascrpt values" and realized that I had not put "object" into my search but to my suprise a few developer.mozilla sites still came up with relative content. I feel I am getting better at least recognizing formatting on pages that is easier for my brain to comprehend.
Imagine that you're taking your favorite board game and turning it into a computer-based game.
-
Name of board game: Yahtzee
-
Use the space below to categorize game data into each of the following data types. You should have a minimum of two pieces of data for each category.
- String data: ["Rules", "Object of game", "Game Start", "Scoring"]
- Integer and/or float data: How many dice do you play with? [ 5 ] How many points is a Full House worth [25]?
- Boolean data: If you have 2 of a kind and 3 of a kind you have a Full House. A rule explicit to Full House is you must use all 5 dice and can only count each die once.
If you roll [ 3,3,5,5,5] then 2 of a kind =True and 3 of a kind =True (all 5 dice are used and only counted once = True) then it is True you have a Full House.
If you roll [ 2,1,3,3,3] then 2 of a kind = True. and 3 of a kind =True ( all 5 dice are used and only counted once= False) then it is False you do not have a Full House.
-
Array data: For filling in the top of your sheet you count how many you have of each # on each dice face up. ex ACES = Count all die with one face up: If you roll [1,1,1,2,3] then array.aces= [1,1,1] Another Example is a large straight is a sequence of all 5 dice from lowest number to highest number in order. If you roll [1,3,2,4,5] then the array.large-straight= [1,2,3,4,5]
-
Hash or Object data: When figuring out your score for how to add up your points you could use object data to keep track of what (Name of Scoring Section) is worth ( Points Scored Section is worth). Ex: Scoring.lower-section{ "3 of a Kind": "Add total of all dice", "4 of a Kind" : " Add total of all dice", "Small Straight": 30, "Large Straight": 40, "Full House": 25, "First Yahtzee": 50, "Second Yahtzee" 100}
Or When figuring out your total points for top section { "Aces": 2, "Twos" : 4, "Threes" : 6, "Fours" : 4, "fives" : 10, "sixes" :18 }
-
Create a list below of three real-life situations where iteration is used. For each situation, explain why it would be an example of iteration.
-
Practicing Choreography for Phantom Circus. I start with the first choreography and the go through the list repeating the action of "rehearse choreo" for each song. Because I repeat the same action of rehearsing on the list of choreographies that need to be rehearsed it would be an example of iteration.
-
Watering all the plants in my house is an example of iteration because I water each plant to its needs then repeat until all plants are watered.
-
Feeding the animals in the house is an example of iteration becuase I feed each animal what it needs then repeat the action for each animal until each animal is feed.
-
Create a list below of three programming situations where iteration would be used. For each situation, explain why it would be an example of iteration.
-
A program that the songs I need to rehearse everyday in a sequence, one after the other, would be an example of iteration because it would perform the same action of playing the song on every song in a sequence until it completed th loop.
-
A Program that uses an algoithm to rearrange a certain set of numbers into every possible arrangement could be an iteration by repeating all possible arrangements of numbers.
-
A program that counted the number of student names under each grade could be an iteration because it would repeat the action of - counting names- under each grade 9,10,11,12 until it completed the task.
- Watch this video and follow each step to modify your own bash profile. As mentioned in the video, you will need this snippet below:
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "[${BRANCH}${STAT}]"
else
echo ""
fi
}
# get current status of git repo
function parse_git_dirty {
status=`git status 2>&1 | tee`
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
bits=''
if [ "${renamed}" == "0" ]; then
bits=">${bits}"
fi
if [ "${ahead}" == "0" ]; then
bits="*${bits}"
fi
if [ "${newfile}" == "0" ]; then
bits="+${bits}"
fi
if [ "${untracked}" == "0" ]; then
bits="?${bits}"
fi
if [ "${deleted}" == "0" ]; then
bits="x${bits}"
fi
if [ "${dirty}" == "0" ]; then
bits="!${bits}"
fi
if [ ! "${bits}" == "" ]; then
echo " ${bits}"
else
echo ""
fi
}
export PS1="\u\w\`parse_git_branch\`$ "
If you have any questions, comments, or confusions from the any of the readings that you would an instructor to address, list them below:
Nice work, @dawnlunacy!