-
Notifications
You must be signed in to change notification settings - Fork 176
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
Saba Bhamidipati #155
base: main
Are you sure you want to change the base?
Saba Bhamidipati #155
Changes from 1 commit
0e5ee38
0fc4375
18742f1
f2d1ba1
aa8123f
f738542
723d6ef
37ccd80
61f289d
2b17ee6
d86bc8b
17c3d1f
44e6afb
fa04224
5e0c56b
39411fa
d8ba534
98b8d4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,16 @@ | |
|
||
# Build a Bear | ||
|
||
# create a method with multiple parameters | ||
def build_a_bear(name, age, fur, clothes, special_power) | ||
# interpolation of name in greeting string value | ||
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. Yes, AND that string is being assigned the the variable |
||
greeting = "Hey partner! My name is #{name} - will you be my friend?!" | ||
# variable defined to combine dynamic variables name and age | ||
demographics = [name, age] | ||
# dynamic variable that takes argument passed to it through object instance (not 100% sure bc I don't see a class creation here) | ||
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. I'm glad you noted you weren't 100% clear - The variable |
||
power_saying = "Did you know that I can #{special_power}?" | ||
# hash with keys that are attributes of a built bear, and values taken from combined variables | ||
# along with a nested array that has three speech modes for the bear | ||
built_bear = { | ||
'basic_info' => demographics, | ||
'clothes' => clothes, | ||
|
@@ -19,25 +25,36 @@ def build_a_bear(name, age, fur, clothes, special_power) | |
return built_bear | ||
end | ||
|
||
# Two instances of build_a_bear class: Fluffy and Sleepy | ||
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. Let's be careful here - |
||
build_a_bear('Fluffy', 4, 'brown', ['pants', 'jorts', 'tanktop'], 'give you nightmares') | ||
build_a_bear('Sleepy', 2, 'purple', ['pajamas', 'sleeping cap'], 'sleeping in') | ||
|
||
|
||
# FizzBuzz | ||
|
||
# define method with three parameters, two numbers and a max | ||
def fizzbuzz(num_1, num_2, range) | ||
# inclusive range operator, that will iterate through each number | ||
(1..range).each do |i| | ||
# modulo operator divides left number by both num_1 and num_2 and gets a remainder | ||
# of 0, the i is a multiple of both, and it will return FizzBuzz | ||
if i % num_1 === 0 && i % num_2 === 0 | ||
puts 'fizzbuzz' | ||
# if the modulo operator finds a 0 remainder for the left number and num1 ONLY, | ||
# return 'fizz' | ||
elsif i % num_1 === 0 | ||
puts 'fizz' | ||
# else if the modulo operator finds a 0 remainder for the left number and num2 ONLY, | ||
# return 'buzz' | ||
elsif i % num_2 === 0 | ||
puts 'buzz' | ||
# else if modulo operator finds a >0 remainder for both, return i value | ||
else | ||
puts i | ||
end | ||
end | ||
end | ||
|
||
# two instances of fizzbuzz(factors 3,5,range 100) and (factors 5,8,range 400) | ||
fizzbuzz(3, 5, 100) | ||
fizzbuzz(5, 8, 400) | ||
fizzbuzz(5, 8, 400) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,45 +2,107 @@ | |
|
||
# Declare two variables - hero_name AND special_ability - set to strings | ||
|
||
hero_name = "Superman" | ||
special_ability = "super strength" | ||
|
||
# puts hero_name | ||
# puts special_ability | ||
|
||
# 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, #{hero_name}" | ||
catchphrase = "How is your #{special_ability} today?" | ||
|
||
# puts greeting | ||
# puts catchphrase | ||
|
||
# Declare two variables - power AND energy - set to integers | ||
|
||
power = 100 | ||
energy = 473 | ||
|
||
# Declare two variables - full_power AND full_energy | ||
# full_power should multiply your current power by 500 | ||
# full_energy should add 150 to your current energy | ||
|
||
full_power = power * 100 | ||
full_energy = energy + 150 | ||
|
||
# puts full_power | ||
# puts full_energy | ||
|
||
# Declare two variables - is_human and identity_concealed - assigned to booleans | ||
|
||
is_human = false | ||
identity_concealed = true | ||
|
||
# puts is_human | ||
# puts identity_concealed | ||
|
||
# Declare two variables - arch_enemies AND sidekicks | ||
# 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 | ||
|
||
arch_enemies = ['Lex Luthor', 'Brainiac', 'Darkseid', 'Doomsday'] | ||
sidekicks = ['Supergirl', 'Lois Lane', 'Superboy'] | ||
|
||
# print arch_enemies | ||
# puts '' | ||
# print sidekicks | ||
|
||
# Print the first sidekick to your terminal | ||
# puts '' | ||
puts sidekicks[0] | ||
|
||
# Print the last arch_enemy to the terminal | ||
# puts'' | ||
puts arch_enemies[3] | ||
|
||
# Write some code to add a new arch_enemy to the arch_enemies array | ||
arch_enemies[4] = 'Bizarro' | ||
|
||
# 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 | ||
arch_enemies.shift() | ||
|
||
# print arch_enemies | ||
|
||
# Print the sidekicks array to terminal to ensure you added a new sidekick | ||
sidekicks[3] = 'Batman' | ||
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) | ||
|
||
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. Please come back to this and let me know when you've completed it! 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. SCRATCH THAT, you already did on line 94, my bad. |
||
end | ||
|
||
assess_situation(0, "Cashapp please", "This is not a job for me") | ||
|
||
# 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. | ||
|
||
def assess_situation(danger_level, save_the_day, bad_excuse) | ||
if danger_level > 50 | ||
puts bad_excuse | ||
elsif danger_level >= 10 && danger_level <= 50 | ||
puts save_the_day | ||
else | ||
puts "Meh. Hard pass." | ||
end | ||
end | ||
|
||
assess_situation(5, "Cashapp please", "This is not a job for me") | ||
|
||
#Test Cases | ||
announcement = 'Never fear, the Courageous Curly Bracket is here!' | ||
excuse = 'I think I forgot to lock up my 1992 Toyota Coralla. Be right back.' | ||
|
@@ -56,29 +118,96 @@ | |
# - luckyNumbers (array) | ||
# - address (hash with following key/values: number , street , state, zip) | ||
|
||
scary_monster = { | ||
|
||
name: "Saba", | ||
smell: "terrible", | ||
weight: 250, | ||
citiesDestroyed: ['Tokyo', 'Osaka', 'Hokkaido'], | ||
luckyNumbers: [4, 15, 22], | ||
address: {number: 580, street: "Lexington Ave", state: "New York", zip: 11002} | ||
|
||
} | ||
|
||
# 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 | ||
|
||
class SuperHero | ||
attr_accessor :name, :super_power, :age | ||
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. We don't need the |
||
attr_reader :arch_nemesis, :power_level, :energy_level | ||
def initialize(name, super_power, age, arch_nemesis, power_level, energy_level) | ||
@name = name | ||
@super_power = super_power | ||
@age = age | ||
@arch_nemesis = "The Syntax Error" | ||
@power_level = 100 | ||
@energy_level = 50 | ||
end | ||
end | ||
|
||
# - Create the following class methods | ||
# - say_name, should print the hero's name to the terminal | ||
# - maximize_energy, should update the energy_level to 1000 | ||
# - gain_power, should take an argument of a number and INCREASE the power_level by that number | ||
|
||
class SuperHero | ||
attr_accessor :name, :super_power, :age | ||
attr_reader :arch_nemesis, :power_level, :energy_level | ||
def initialize(name, super_power, age) | ||
@name = name | ||
@super_power = super_power | ||
@age = age | ||
@arch_nemesis = "The Syntax Error" | ||
@power_level = 100 | ||
@energy_level = 50 | ||
end | ||
|
||
def say_name | ||
puts "#{name}" | ||
end | ||
|
||
def maximize_energy(level) | ||
puts "energy_level is #{@energy_level*level}" | ||
end | ||
|
||
def gain_power(add_power) | ||
new_power = @power_level + add_power | ||
puts "#{new_power}" | ||
end | ||
end | ||
|
||
|
||
# - Create 2 instances of your SuperHero class | ||
|
||
superman = SuperHero.new('Superman', 'Super strength', 47) | ||
|
||
superwoman = SuperHero.new('Superwoman', 'Max speed', 40) | ||
|
||
# Reflection | ||
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. YOU GOT THIS!! I love this reflection. I think these concepts you've pulled out of:
ARE SPOT ON! It is a TON of work and what I've seen so far, and this reflection here, really makes me feel like you are on the right track. You can not let up though. You got this. |
||
# What parts were most difficult about this exerise? | ||
# First, I thought I had at least a working understanding of putting together methods, | ||
# hashes, and classes. But the moment they become even slightly complicated, I feel | ||
# like my knowledge base crumbles. It felt incredibly complicated to create a method | ||
# with multiple parameters. Then inserting a conditional therein was also challenging. | ||
|
||
# Second, creating a class with static and dynamic values should have been much easier. | ||
# But the moment I tried to initialize them, I realized I was making mistakes. It's incredible | ||
# how important little details are. I realzied that I need to go back and spend a lot of time | ||
# not just practicing these things, but rationalizing the logic behind them, and Then | ||
# learn to make mistakes and fix them. I need to be conversant with hashes, arrays, classes, | ||
# methods, and variations of all of these. It's going to be 70% practice, and 30% deciphering. | ||
|
||
# What parts felt most comfortable to you? | ||
# I feel comfortable with conditionals, because they're not very different in Excel. | ||
|
||
# What skills do you need to continue to practice before starting Mod 1? | ||
|
||
# Time management! And going through ALL the Mod 1 prework, challenging myself to work through | ||
# the exercises, and doing them far more autonomously. You really don't understand your gaps | ||
# until you sit down to do comprehensive exercises that add layers of complexity. |
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.
I think that final note you drafted up at the bottom is PERFECT, will give your a mentor a feel for what you struggle with.
The questions about communication time frames - what it's asking is, if you are super busy (in classes, stressed about a project) and your mentor DMs you, you might not be able to give a thoughtful response in the heat of the moment. If you are having a super busy stressful week, typically they'll appreciate if within 6-12 hours you acknowledge you got it but let them know you can't fully respond, but let them know you can fully respond within another XX hours. I think that usually sounds like a reasonable communication expectation but when Turing gets really busy, that one seems to fall by the wayside and impact relationships/trust.
BTW 🤩I was a 7th grade math teacher too!