Skip to content
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

Aleisha Mork #71

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions section1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Read the three blog posts that follow:
* [Asking better questions](https://dev.to/josefine/asking-better-questions-2e2k)
* [Your Questions Are Dumb; Ask Them Anyway](https://dev.to/kathryngrayson/your-questions-are-dumb-ask-them-anyway-3cm6)

Reflect on these posts, and how you feel about asking questions (specifically, technical questions as you enter your technical work at Turing). How might this positively or negatively impact your growth?
Reflect on these posts, and how you feel about asking questions (specifically, technical questions as you enter your technical work at Turing). How might this positively or negatively impact your growth?

It's going to take some time to find that balance between googling and pushing yourself to solve a problem without hand-holding, and reaching out for help. That's ok! Be patient with yourself. The way you will find that balance is by being aware of how you currently operate. Keep this on your mind as you work through this section, and...there is no time like the present to start asking questions.

Expand Down Expand Up @@ -169,11 +169,11 @@ This will open the `section1` directory in Atom. You should be able to see the d

>In this Section, you may see references to `irb`. `irb` is short of "Interactive Ruby" and is a tool that allows us to run Ruby code inside the Terminal. To open and `irb` _session_, type `irb` in your Terminal. At that point, you can type any valid Ruby code, then press return. To exit the `irb` session, run `exit`.

1. Next, you will complete several lessons from the Learn Ruby the Hard Way Tutorial.
1. Next, you will complete several lessons from the Learn Ruby the Hard Way Tutorial.

*For ***each*** lesson* ***follow these directions closely***:

1. Create a file within your `section1` directory that will contain this lesson's work. Verify that you are within the directory by using terminal command `pwd`. If you are not, `cd` into your `section1` directory. Once you are there, use the `touch` command in the Terminal to create a file. For the first lesson, name this file `ex1.rb`. For each subsequent lesson, use `ex2.rb`, `ex3.rb`, so on, so forth.
1. Create a file within your `section1` directory that will contain this lesson's work. Verify that you are within the directory by using terminal command `pwd`. If you are not, `cd` into your `section1` directory. Once you are there, use the `touch` command in the Terminal to create a file. For the first lesson, name this file `ex1.rb`. For each subsequent lesson, use `ex2.rb`, `ex3.rb`, so on, so forth.

2. Work through the lesson, **typing** the code into your file, and running it in the Terminal with `ruby ex1.rb`, replacing `ex1` with the actual file name of what you'd like to run. Make sure the output you get is similar to what the lesson shows. If you get an error saying "No such file or directory", be sure to verify the directory you are located in via the Terminal- running command `ls` should show the file you are trying to run.

Expand All @@ -183,19 +183,19 @@ This will open the `section1` directory in Atom. You should be able to see the d

2. Check off the items below as you complete the steps you just read for each lesson. ***Remember to create a file containing your work for each lesson!***

- [ ] [A Good First Program](https://learnrubythehardway.org/book/ex1.html)
- [x] [A Good First Program](https://learnrubythehardway.org/book/ex1.html)

- [ ] [Comments in Code](https://learnrubythehardway.org/book/ex2.html)
- [x] [Comments in Code](https://learnrubythehardway.org/book/ex2.html)

- [ ] [Numbers and Math](https://learnrubythehardway.org/book/ex3.html)
- [x] [Numbers and Math](https://learnrubythehardway.org/book/ex3.html)

- [ ] [Variables and Names](https://learnrubythehardway.org/book/ex4.html)
- [x] [Variables and Names](https://learnrubythehardway.org/book/ex4.html)

- [ ] [Strings](https://learnrubythehardway.org/book/ex5.html)
- [x] [Strings](https://learnrubythehardway.org/book/ex5.html)

- [ ] [More Strings](https://learnrubythehardway.org/book/ex6.html)
- [x] [More Strings](https://learnrubythehardway.org/book/ex6.html)

- [ ] [Asking for Input](https://learnrubythehardway.org/book/ex11.html)
- [x] [Asking for Input](https://learnrubythehardway.org/book/ex11.html)


3. Work through the [Strings](http://tutorials.jumpstartlab.com/projects/ruby_in_100_minutes.html#3.-strings) and [Numbers](http://tutorials.jumpstartlab.com/projects/ruby_in_100_minutes.html#5.-numbers) sections from Ruby in 100 Minutes. For each of these sections, open an `irb` session by typing `irb` into the Terminal and type in the code snippets provided.
Expand Down
13 changes: 13 additions & 0 deletions section1/ex1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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.'

# Study Drills:
# 1#:
puts "Welcome to Section 1."

# 3: It makes the text greyed out, and it does not print in the terminal.
29 changes: 29 additions & 0 deletions section1/ex11.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
print "What is your name? "
name = gets.chomp
print "How old are you? "
age = gets.chomp.to_i
print "What month is your birthday? "
month = gets.chomp
print "How tall are you? "
height = gets.chomp
print "How much do you weigh? "
weight = gets.chomp

puts "So #{name} you're #{age} old, #{height} tall and #{weight} heavy."

puts "And in #{month} #{name} will be #{age +1}!"


# Study Drills:

# 1: gets.chomp -
# gets - Pauses the program to get input from the user
#. chomp - removes the 'enter' (aka new line) character that was entered

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

# due to the enter/return key being hit to continue the program so that the
# 'new line' character is not stored as part of the input value

# 2:
# I found gets.chop which removes whatever the last character entered and teh 'new line' character
# I found gets.strip which removes excess space characters before or after what is entered

# 3: See line 1, 2, 5, 6, 12, and 14
9 changes: 9 additions & 0 deletions section1/ex2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# A comment, this is so you can read your program later.
# Anything after the # is ignored by ruby.

puts "I could have code like this." # and the comment after is ignored

# You can also use a comment to "disable" or comment out a piece of code:
# puts "This won't run."

puts "This will run."
42 changes: 42 additions & 0 deletions section1/ex3.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# prints a text string
puts "I will now count my chickens:"

# prints the string Hens and prints the calculation of the following math problem
puts "Hens #{25.0 + 30.0 / 6.0}"
# prints the string Roosters and prints the calculation of the following math problem
puts "Roosters #{100.0 - 25.0 * 3.0 % 4.0}"

# prints the following text string
puts "Now I will count the eggs:"

# prints the calculation of the following math problem
puts 3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0

# prints the following string of text
puts "Is it true that 3 + 2 < 5 - 7?"

# prints if the following math statment is true or false
puts 3.0 + 2.0 < 5.0 - 7.0

# prints the text string and solves the math calculation provided between the brackets
puts "What is 3 + 2? #{3.0 + 2.0}"
puts "What is 5 - 7? #{5.0 - 7.0}"

# prints the following string of text
puts "Oh, thats why its's false."

puts "How about some more."

# prints the following string and if the equation in the brackets is true or false
puts "Is it greater? #{5.0 > -2.0}"
puts "Is it greater or equal? #{5.0 >= -2.0}"
puts "Is it less or equal? #{5.0 <= -2.0}"


#Study Drills:
# 1: See above.

# 2: Done in 'irb' nothing to show here.
# 3: I dont want to create an additional file... can I just do it here?
puts (8 + (8.75 - 1.75) + 8.75 + 5.5) - 40
# 4: See above.
42 changes: 42 additions & 0 deletions section1/ex4.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This assigns the variable name car to the value 100
cars = 100
# This assigns the variable name space_in_a_car to the value 4.0
space_in_a_car = 4
# This assigns the variable name drivers to the value 30
drivers = 30
# This assigns the variable name passengers to the value 90
passengers = 90
# This assigns the variable name cars_not_driven to the value of the variable 'car' less the value of the variable 'drivers'
cars_not_driven = cars - drivers
# This assigns the variable name cars_driven to the value of the variable 'drivers'
cars_driven = drivers
# This assigns the variable name carpool_capacity to the value of the variable cars_driven multiplied by the value of the variable space_in_a_car
carpool_capacity = cars_driven * space_in_a_car
# This assigns the variable name average_passengers_per_car to the value of teh variable passengers divided by the value of the variable cars_driven
average_passengers_per_car = passengers / cars_driven


# The following uses the variables assigned above within a string, the value assigned will print rather than the variable name.
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."


# Study Drills:

# Error received in Study Drill: It appears this error would be
# due to carpool_capacity not being listed in the opening with
# what it equals. Because this name was not given a value it is
# an unknown variable.

#1 & 2:
# Making is 4 vs 4.0 does not change any of the calculated
# values however it does remove the float, so could create
# different values depending on the other numbers used. In
# in this situation since you can not have part of a person
# or seat removing the float is probably best.

# 3: See above.
24 changes: 24 additions & 0 deletions section1/ex5.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name = 'Zed A. Shaw'
age = 35
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."

puts "If I add #{age}, #{height}, and #{weight} I get #{age + height + weight}."


# Study Drills:

# 1: See above - removed the 'my_'
# 2:
puts "#{74 * 2.54} - Is Zed's height in centimeters."
puts "#{180 / 2.205} - Is Zed's weight in kilograms."
46 changes: 46 additions & 0 deletions section1/ex6.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Assigning a variable
types_of_people = 10
# Assigns a variable that has a string containing another variable as the value
x = "There are #{types_of_people} types of people."
# Assigns a string variable
binary = "binary"
do_not = "don't"
# Assigns a variable with a string value that contains/referances other variables that are strings
y = "Those who know #{binary} and those who #{do_not}."

# Prints the assigned variables
puts x
puts y

# Prints the assigned string variables within another string
puts "I said: #{x}."
puts "I also said: '#{y}'."

# Assigning new variables
hilarious = false
joke_evaluation = "Isn't that joke so funny?! #{hilarious}"

# Prints the assigned string variable
puts joke_evaluation

# Assigns new variables with string values
w = "This is the left side of..."
e = "a string with a right side."

# Prints the assigned string values for each variable. Combining them to make 1 printed string
puts w + e


# Study Drills:

# 1 & 2: - See Above

# 3:
# This works because you are adding the values of the variables
# assigned to 'w' & 'e' so it's kinda working like
# "put this and also put this"

# 4:
# Some still work. But the ones that don't I think its because
# the computer does not know how to tell when its the end of
# a string vs an apostrophe or quotes within a statement.
3 changes: 3 additions & 0 deletions section1/exercises/booleans.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
p 7 > 2

# YOU DO: print to the terminal the result of "hello" is equal to "Hello":
p "hello" == "Hello"

# YOU DO: print to the terminal the result of 3 is not equal to 4:
puts 3 != 4

# YOU DO: print to the terminal the result of 4 is less than or equal to 5:
puts 4 <= 5
19 changes: 13 additions & 6 deletions section1/exercises/interpolation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,30 @@

# Write code that uses the variables below to form a string that reads
# "The quick red fox jumped over the lazy brown dog":

speedy = "quick red fox"
slow_poke = "lazy brown dog"

p # YOUR CODE HERE
p "The #{speedy} jumped over the #{slow_poke}"


# Write code that uses the variables below to form a string that reads
# "In a predictable result, the tortoise beat the hare!":

slow_poke = "tortoise"
speedy = "hare"

# YOUR CODE HERE
p "In a predictable result, the #{slow_poke} beat the #{speedy}!"


# YOU DO:
# Declare three variables, name/content/data type of your choice. Think carefully
# about what you name the variables. Remember, the goal is to be concise but
# descriptive (it's a hard balance!) Then, print ONE sentence that incorporates
# Declare three variables, name/content/data type of your choice. Think carefully
# about what you name the variables. Remember, the goal is to be concise but
# descriptive (it's a hard balance!) Then, print ONE sentence that incorporates
# all THREE variables.

# YOUR CODE HERE
name = "Deb"
activity = "to the mall"
time = "weekend"

p "#{name} went #{activity} this #{time}."
12 changes: 8 additions & 4 deletions section1/exercises/loops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@

# Write code that prints the sum of 2 plus 2 seven times:
7.times do
# YOUR CODE HERE
p 2 + 2
end

# Write code that prints the phrase 'She sells seashells down by the seashore'
# ten times:
# YOUR CODE HERE
10.times do
p "She sells seashells down by the seashore"
end


# Write code that prints the result of 5 + 7 a total of 9 timees
# YOUR CODE HERE
# Write code that prints the result of 5 + 7 a total of 9 times
9.times do
p 5 + 7
end
6 changes: 3 additions & 3 deletions section1/exercises/numbers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
p 2 + 2

# Write code that prints the result of 7 subtracted from 83:
p #YOUR CODE HERE
puts 83 - 7

# Write code that prints the result of 6 multiplied by 53:
# YOUR CODE HERE
puts 6 * 53

# Write code that prints the result of the modulo of 10 into 54:
# YOUR CODE HERE
puts 10 % 54
8 changes: 4 additions & 4 deletions section1/exercises/strings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# `ruby section1/exercises/strings.rb`

# Example: Write code that prints your name to the terminal:
p "Alan Turing"
p "Aleisha Mork"

# Write code that prints `Welcome to Turing!` to the terminal:
p #YOUR CODE HERE
p "Welcome to Turing!"

# Write code that prints `99 bottles of pop on the wall...` to the terminal:
# YOUR CODE HERE
puts "99 bottles of pop on the wall..."

# Write out code to print one line from your favorite song or movie.
# YOUR CODE HERE
puts "Even though I don't tell you all the time you had my heart a long,long time ago"
Loading