forked from turingschool-examples/backend_mod_1_prework
-
Notifications
You must be signed in to change notification settings - Fork 176
Conor Barthel #166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
conorbarthel
wants to merge
15
commits into
turingschool:main
Choose a base branch
from
conorbarthel:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conor Barthel #166
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2149a7f
Add Section 1
conorbarthel 8caa5c3
Add Section2 work
conorbarthel 4cb86f4
Add section 3 exercises and reflection
conorbarthel ed322f9
Add section4 exercises and reflection
conorbarthel 8a4bfec
Refactor code in sections1-4 and add final prep exercises
conorbarthel 8d48719
Update README.md
conorbarthel 9a74f68
Update README.md
conorbarthel bfc8ffa
Update README.md
conorbarthel 260a1c3
Update README.md
conorbarthel 5d269b8
Update README.md
conorbarthel fa37f7a
Update README.md
conorbarthel 1648542
Update README.md
conorbarthel 5e0559c
Update README.md
conorbarthel b1f14b3
Update README.md
conorbarthel 08c9cde
Update README.md
conorbarthel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,41 +3,63 @@ | |
| # Use the # to create a new comment | ||
|
|
||
| # Build a Bear | ||
|
|
||
| #defines a method build_a_bear with inputs of name, age, fur, clothes, special_power | ||
| def build_a_bear(name, age, fur, clothes, special_power) | ||
| #saves variable greeting as a string interpolating the name input | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A more technical way to say this would be "declare a variable greeting" |
||
| greeting = "Hey partner! My name is #{name} - will you be my friend?!" | ||
| #saves variable demographics as an array containing name and age inputs | ||
| demographics = [name, age] | ||
| #saves variable power_saying as a sting interpolating the input special_power | ||
| power_saying = "Did you know that I can #{special_power}?" | ||
| #saves a hash built_bear | ||
| built_bear = { | ||
| #next three lines save key value pairs with the keys 'basic_info', 'clothes', and 'exterior' | ||
| #assigned to values from the method inputs | ||
| 'basic_info' => demographics, | ||
| 'clothes' => clothes, | ||
| 'exterior' => fur, | ||
| #saves key 'cost to a float' | ||
| 'cost' => 49.99, | ||
| #saves key 'sayings' to an array containing inputs and a string | ||
| 'sayings' => [greeting, power_saying, "Goodnight my friend!"], | ||
| #saves key to a boolean | ||
| 'is_cuddly' => true, | ||
| } | ||
| #method outputs the hash built_bear | ||
| return built_bear | ||
| #closes build_a_bear method | ||
| end | ||
|
|
||
| #two different method calls of the build_a_bear method containing inputs: | ||
| #name, age, fur, clothes, special_power | ||
| build_a_bear('Fluffy', 4, 'brown', ['pants', 'jorts', 'tanktop'], 'give you nightmares') | ||
| build_a_bear('Sleepy', 2, 'purple', ['pajamas', 'sleeping cap'], 'sleeping in') | ||
|
|
||
|
|
||
| # FizzBuzz | ||
|
|
||
| #defines method fizzbuzz the takes inputs of num_1, num_2, and range | ||
| def fizzbuzz(num_1, num_2, range) | ||
| #from the intiger 1 to the input of range do the follwing to each of the intigers | ||
| (1..range).each do |i| | ||
| #if the intiger is divided by num_1 and there is no remainder AND | ||
| #if the intiger is divided by num_2 and there is no remainder print the string | ||
| #'fizzbuzz' | ||
| if i % num_1 === 0 && i % num_2 === 0 | ||
| puts 'fizzbuzz' | ||
| #else if the intiger is divisible by num_1 print the string "fizz" | ||
| elsif i % num_1 === 0 | ||
| puts 'fizz' | ||
| #else if the intiger is divisible by num_2 print the sting "buzz" | ||
| elsif i % num_2 === 0 | ||
| puts 'buzz' | ||
| #else return the intigers | ||
| else | ||
| puts i | ||
| #closes if/else statement | ||
| end | ||
| #closes .each method (loop) | ||
| end | ||
| #closes fizzbuzz method | ||
| end | ||
|
|
||
| #calls the method fizzbuzz twice with the inputs of num_1, num_2, and range | ||
| fizzbuzz(3, 5, 100) | ||
| fizzbuzz(5, 8, 400) | ||
| fizzbuzz(5, 8, 400) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more technical way to say this would be "defines a method build_a_bear with parameters of name, age, fur, clothes, special_power"