forked from turingschool-examples/backend_mod_1_prework
-
Notifications
You must be signed in to change notification settings - Fork 176
Sully Birashk #164
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
SullyBirashk
wants to merge
8
commits into
turingschool:main
Choose a base branch
from
SullyBirashk: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
Sully Birashk #164
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ae336a4
Add Section 1
SullyBirashk 14ace01
Add Section 2 work
SullyBirashk cc4cc74
Update Reflection
SullyBirashk 419b7b4
Fix Reflection
SullyBirashk c2b98f8
Add Section 3
SullyBirashk ccd2fec
Add Section 4
SullyBirashk 9628f18
Finalize homework
SullyBirashk 0cc0e4d
Update README.md
SullyBirashk 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
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 |
|---|---|---|
| @@ -1,45 +1,75 @@ | ||
| # Challenge - See if you can follow the instructions and complete the exercise in under 30 minutes! | ||
|
|
||
| # Declare two variables - hero_name AND special_ability - set to strings | ||
| hero_name = "Sully" | ||
|
|
||
| special_ability = "Speed" | ||
| # Declare two variables - greeting AND catchphrase | ||
| # greeting should be assigned to a string that uses interpolation to include the hero_name | ||
| # catchphrase should be assigned to a string that uses interpolation to include the special_ability | ||
| greeting = "Hello stranger! I am #{hero_name}!" | ||
|
|
||
| catchphrase = "I am #{special_ability}!" | ||
|
|
||
| # Declare two variables - power AND energy - set to integers | ||
| power = 7 | ||
|
|
||
| energy = 7 | ||
|
|
||
| # Declare two variables - full_power AND full_energy | ||
| full_power = 3500 | ||
|
|
||
| full_energy = 157 | ||
| # full_power should multiply your current power by 500 | ||
| # full_energy should add 150 to your current energy | ||
|
|
||
| # Declare two variables - is_human and identity_concealed - assigned to booleans | ||
| is_human = true | ||
|
|
||
| identity_concealed = false | ||
|
|
||
| # Declare two variables - arch_enemies AND sidekicks | ||
| arch_enemies = ["Professor Slow Poke", "Reverse Flash", "Zoom"] | ||
|
|
||
| sidekicks = ["Chewey", "Dwight Schrute", "Pedro Sanchez"] | ||
| # arch_enemies should be an array of at least 3 different enemy strings | ||
| # sidekicks should be an array of at least 3 different sidekick strings | ||
|
|
||
| # Print the first sidekick to your terminal | ||
|
|
||
| print sidekicks[0] | ||
| # Print the last arch_enemy to the terminal | ||
|
|
||
| print arch_enemies[2] | ||
| # Write some code to add a new arch_enemy to the arch_enemies array | ||
|
|
||
| arch_enemies[3] = "Hank" | ||
| # Print the arch_enemies array to terminal to ensure you added a new arch_enemey | ||
|
|
||
| print arch_enemies | ||
| # Remove the first sidekick from the sidekicks array | ||
|
|
||
| sidekicks.delete("Chewey") | ||
| # Print the sidekicks array to terminal to ensure you added a new sidekick | ||
|
|
||
| print sidekicks | ||
| # Create a function called assess_situation that takes three arguments - danger_level, save_the_day, bad_excuse | ||
| # - danger_level should be an integer | ||
| # - save_the_day should be a string a hero would say once they save the day | ||
| # - save_the_day should be a string a hero would say once they save the day | ||
| # - bad_excuse should be a string a hero would say if they are too afraid of the danger_level | ||
| def assess_situation(danger_level, save_the_day, bad_excuse) | ||
|
|
||
| if danger_level > 50 | ||
| puts bad_excuse | ||
| end | ||
|
|
||
| # Your function should include an if/else statement that meets the following criteria | ||
| if danger_level < 50 | ||
|
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. What if danger_level == 50 ? |
||
| puts save_the_day | ||
| elsif danger_level < 10 | ||
| puts "Meh, Hard Pass" | ||
| end | ||
|
|
||
| end | ||
| # | ||
|
|
||
| #Your function should include an if/else statement that meets the following criteria | ||
| # - Danger levels that are above 50 are too scary for your hero. Any danger level that is above 50 should result in printing the bad_excuse to the terminal | ||
| # - Anything danger_level that is between 10 and 50 should result in printing the save_the_day string to the terminal | ||
| # - If the danger_level is below 10, it means it is not worth your time and should result in printing the string "Meh. Hard pass." to the terminal. | ||
| # - If the danger_level is below 10, it means it is not worth your time and should result in printing the string Meh. Hard pass.to the terminal. | ||
|
|
||
| #Test Cases | ||
| announcement = 'Never fear, the Courageous Curly Bracket is here!' | ||
|
|
@@ -55,17 +85,32 @@ | |
| # - citiesDestroyed (array) | ||
| # - luckyNumbers (array) | ||
| # - address (hash with following key/values: number , street , state, zip) | ||
| scary_monstern = { | ||
| "name" => "DoomStep" , | ||
| "smell" => "Hot Garbage" , | ||
| "weight" => 487 , | ||
| "cities_destroyed" => ["Tokoyo","Rome","Frace","Italy"] , | ||
| "lucky_numbers" => [7, 3, 8, 0, 2], | ||
| "address" => { | ||
| "number" => 56095, | ||
| "street" => "Agapanthus", | ||
| "state" => "California", | ||
| "zip" => 92508 | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| # Create a new class called SuperHero | ||
| # - Your class should have the following DYNAMIC values | ||
| # - name | ||
| # - name | ||
| # - super_power | ||
| # - age | ||
| # - age | ||
| # - Your class should have the following STATIC values | ||
| # - arch_nemesis, assigned to "The Syntax Error" | ||
| # - power_level = 100 | ||
| # - energy_level = 50 | ||
| # - energy_level = 50 | ||
|
|
||
| # - Create the following class methods | ||
| # - say_name, should print the hero's name to the terminal | ||
|
|
@@ -74,11 +119,42 @@ | |
|
|
||
| # - Create 2 instances of your SuperHero class | ||
|
|
||
| class SuperHero | ||
|
|
||
| def initialize(name, super_power, age) | ||
| @name = say_name | ||
| @super_power = super_power | ||
| @age = age | ||
| @arch_nemesis = "The Syntax Error" | ||
| @power_level = 100 | ||
| @energy_level = 50 | ||
| end | ||
|
|
||
| def say_name | ||
| print @name | ||
| end | ||
|
|
||
| def maximize_energy | ||
| @energy_level = 1000 | ||
| puts "Your Maximum Energy Level has hit an all time high at #{@energy_level}!" | ||
| end | ||
|
|
||
| def gain_power(number) | ||
| @power_level += (number) | ||
| puts "Your new Power Level is #{@power_level}" | ||
| end | ||
|
|
||
| end | ||
|
|
||
| # Reflection | ||
| # What parts were most difficult about this exerise? | ||
| "The most difficult part about this exercise was remembering that when I make a hash, | ||
| I had to assign the keys as strings and not just normal variables, took me a while to figure out what was wrong with it." | ||
|
|
||
| # What parts felt most comfortable to you? | ||
| "I was pretty comfortable creating functions and also creating classes, They were pretty straight forward and didn't give me | ||
| as many issues with it." | ||
|
|
||
| # What skills do you need to continue to practice before starting Mod 1? | ||
|
|
||
| "A Skill I require to continue before continuing to Mod 1 would be trying to fix what I am working on by viewing it from | ||
| different perspective, or get more practice on how to troubleshoot my own code!" | ||
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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| puts "Hello World!" | ||
| puts "Hello Again" | ||
| puts "I like typing this." | ||
| puts "This is fun." | ||
| puts "Yay! Printing." | ||
| puts "I'd much rather you 'not'." | ||
| # puts 'I "Said" do not touch this.' |
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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # this is my personal comment section. | ||
| puts "Hello World!!" | ||
| #I could honestly use this section to pseudocode that way it doesn't show | ||
| puts "Only this will show" | ||
| #not this suff in between | ||
| puts "Where are the comments?" #Even in front of codes, it still wont show! | ||
| # I could pu you anywhere lol |
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 |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #This is a string | ||
| puts "I will now count my chickens:" | ||
|
|
||
| #The math for Hens | ||
| puts "Hens #{25 + 30 / 6}" | ||
| #The math for Roosters | ||
| puts "Roosters #{100 - 25 * 3 % 4}" | ||
|
|
||
| #This is just a string | ||
| puts "Now I will count the eggs:" | ||
|
|
||
| #This puts a math answer | ||
| puts 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 | ||
|
|
||
| #This prints a string (# QUESTION:) | ||
| puts "Is it true that 3 + 2 < 5 - 7?" | ||
|
|
||
| #This is a bolean, becuase it returns as a true or false | ||
| puts 3 + 2 < 5 - 7 | ||
|
|
||
| puts "What is 3 + 2? #{3 + 2}" | ||
| #This is a string with an answer | ||
| puts "What is 5 - 7? #{5 - 7}" | ||
| #This is a string with an answer | ||
|
|
||
| #This is just a string. | ||
| puts "Oh, That's why it's false." | ||
|
|
||
| #This is just a string. | ||
| puts "How about some more." | ||
| #This uses a bolean becuase it returns ture or false. | ||
| puts "Is it greater #{5 > -2}" | ||
| #This uses a bolean becuase it returns ture or false. | ||
| puts "Is it greater or equal? #{5 >= -2}" | ||
| #This uses a bolean becuase it returns ture or false. | ||
| puts "Is it less or equal? #{5 <= -2}" |
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 |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #These are all assigned variabales. | ||
| cars = 100 | ||
| space_in_a_car = 4 | ||
| drivers = 30 | ||
| passengers = 90 | ||
| #These are variables determined by previous variables. | ||
| cars_not_driven = cars - drivers | ||
| cars_driven = drivers | ||
| carpool_capacity = cars_driven * space_in_a_car | ||
| average_passengers_per_car = passengers / cars_driven | ||
|
|
||
|
|
||
| #These are strings with variables as answers, rather than doing the math yourslef. | ||
| puts "There are #{cars} cars available." | ||
| puts "There are only #{drivers} drivers available." | ||
| puts "There will be #{cars_not_driven} empty cars today." | ||
| puts "We can transport #{carpool_capacity} people today." | ||
| puts "We have #{passengers} to carpool today." | ||
| puts "We need to put about #{average_passengers_per_car} in each car." |
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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| name = 'Zed A. Shaw' | ||
| age = 35 # not a lie in 2009 | ||
| height = 74 # inches | ||
| weight = 180 #lbs | ||
| eyes = 'Blue' | ||
| teeth = 'White' | ||
| hair = 'Brown' | ||
|
|
||
| puts "Let's talk about #{name}." | ||
| puts "He's #{height} inches tall." | ||
| puts "He's #{weight} pounds heavy." | ||
| puts "Actually that's not too heavy." | ||
| puts "He's got #{eyes} eyes and #{hair} hair." | ||
| puts "His teeth are usually #{teeth} depending on the coffee." | ||
|
|
||
| # this line is tricky, try to get it exactly right | ||
| puts "If I add #{age}, #{height}, and #{weight} I get #{age + height + weight}." | ||
|
|
||
| inch = height | ||
| height_in_centimeter = inch * 2.54 | ||
| puts "His height in Centimeters is #{height_in_centimeter} cm." | ||
|
|
||
| lbs = weight | ||
| weight_in_kilos = lbs * 0.453592 | ||
| puts "His weight in Kilos is #{weight_in_kilos} KG" |
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.
These are called parameters. Arguments are the values that you actually pass into the method (i.e. on lines 38 and 40). Parameters and arguments are 2 sides of the same coin, so to speak.