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

Taryn Orlemann #69

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
9 changes: 9 additions & 0 deletions section1/ex1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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.'
puts "Another line."
#puts "You're not gonna see this line!"
24 changes: 24 additions & 0 deletions section1/ex3.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#line 2 will print the string
puts "I will now count my chickens:"
#lines 4 and 5 will print the text and run the maths in the brackets
puts "Hens #{25.0 + 30.0 / 6.0}"
puts "Roosters #{100.0 - 25.0 * 3.0 % 4.0}"
#line 7 will print the string
puts "Now I will count the eggs:"
#line 9 will print the result of the maths
puts 3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0
#line 11 will print the string
puts "Is it true that 3 + 2 < 5 - 7?"
#line 13 will print the result of the boolean
puts 3.0 + 2.0 < 5.0 - 7.0
#lines 15 and 16 will print the text and run the maths in the brackets
puts "What is 3 + 2? #{3.0 + 2.0}"
puts "What is 5 - 7? #{5.0 - 7.0}"
#line 18 will print the string
puts "Oh, that's why it's false."
#line 20 will print the string
puts "How about some more."
#lines 22 23 and 24 will print the text and run the maths in the brackets
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}"
19 changes: 19 additions & 0 deletions section1/ex4.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#lines 2 through 5 will assign values to the variables
cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
#lines 7 through 10 will assign the result of maths performed with the variables we assigned in the above lines to more variables
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven


#lines 14 thourgh 19 will print strings that include out maths results
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."
19 changes: 19 additions & 0 deletions section1/ex5.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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}."
puts "His height in centimeters is #{height * 2.54}."
puts "His weight in kilograms is approximately #{weight / 2.205}."
24 changes: 24 additions & 0 deletions section1/ex6.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# assinging variables
types_of_people = 10
#assigning and string and a variable to a variable
x = "There are #{types_of_people} types of people in the world."
binary = "binary"
do_not = "don't"
y = "Those who know #{binary} and those who #{do_not}."
#prints the variables
puts x
puts y

puts "I said: #{x}."
puts "I also said: '#{y}'."
#assigning boolean to a variable
hilarious = false
#assigning hilarious to another new variable
joke_evaluation = "Isn't that joke so funny?! #{hilarious}"

puts joke_evaluation

w = "This is the left side of..."
e= "a string with a right side."
#concatinating variables
puts w + e
15 changes: 15 additions & 0 deletions section1/ex7.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
print "How old are you? "
age = gets.chomp
print "How tall are you? "
height = gets.chomp
print "How much do you weigh? "
weight = gets.chomp

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

print "What's your favorite place to take a vacation? "
vaca = gets.chomp
print "What's your favorite thing to do there? "
fav = gets.chomp

puts "So, you like to #{fav} when you go to #{vaca}. "
9 changes: 5 additions & 4 deletions section1/exercises/booleans.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
# `ruby section1/exercises/booleans.rb``

# EXAMPLE: print to the terminal the result of 1 is equal to 2:
p 1 === 2
puts 1 === 2

# EXAMPLE: print to the terminal the result of 7 is greater than 2:
p 7 > 2
puts 7 > 2

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

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

puts 3 =/ 4

Choose a reason for hiding this comment

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

Have you tried running this line (either by executing the file or in irb?) This is not the correct Ruby way to say '3 does not equal 4'

# YOU DO: print to the terminal the result of 4 is less than or equal to 5:
print 4 <= 5
20 changes: 14 additions & 6 deletions section1/exercises/interpolation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,36 @@
# "The Chudley Cannons are Ron's favorite Quidditch team":
name = "Ron"
team = "Chudley Cannons"
ron = "The #{team} are #{name}'s favorite Quidditch team"

p "The #{team} are #{name}'s favorite Quidditch team"
puts ron

# 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
puts "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
puts "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.
name = "Taryn"
love = true
does_she = "Does #{name} love raptors? #{love}"

puts does_she



# YOUR CODE HERE
14 changes: 9 additions & 5 deletions section1/exercises/loops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@

# Example: Write code that prints your name five times:
5.times do
p "Hermione Granger"
puts "Hermione Granger"
end

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

# Write code that prints the phrase 'She sells seashells down by the seashore'
# ten times:
# YOUR CODE HERE
10.times do
puts "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
9.times do
puts 5 + 7
end
8 changes: 4 additions & 4 deletions section1/exercises/numbers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# `ruby section1/exercises/numbers.rb`

# Example: Write code that prints the result of the sum of 2 and 2:
p 2 + 2
puts 2 + 2

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

# 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
print 54 % 10
10 changes: 4 additions & 6 deletions section1/exercises/strings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
# `ruby section1/exercises/strings.rb`

# Example: Write code that prints your name to the terminal:
p "Alan Turing"
puts "Taryn O"

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

puts "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
print "They're just ninos trying to release their wiggles"
45 changes: 30 additions & 15 deletions section1/exercises/variables.rb
Original file line number Diff line number Diff line change
@@ -1,60 +1,75 @@
# In the below exercises, write code that achieves
# the desired result. To check your work, run this
# file by entering the following command in your terminal:
# file by entering the following command in your terminal:
# `ruby section1/exercises/variables.rb`

# Example: Write code that saves your name to a variable and
# prints what that variable holds to the terminal:
name = "Harry Potter"
p name
name = "Taryn O"
puts name

# Write code that saves the string 'Dobby' to a variable and
# prints what that variable holds to the terminal:
house_elf = "Dobby"
# YOUR CODE HERE
puts house_elf

# Write code that saves the string 'Harry Potter must not return to Hogwarts!'
# and prints what that variable holds to the terminal:
# YOUR CODE HERE
quote = "Harry Potter must not return to Hogwarts!"
puts quote

# Write code that adds 2 to the `students` variable and
# prints the result:
students = 22
# YOUR CODE HERE
p students
students = students + 2
puts students

# Write code that subracts 2 from the `students` variable and
# prints the result:
# YOUR CODE HERE
p students
students = students - 2
puts students


# YOU DO:
# Declare three variables, named `first_name`, `is_hungry` and `number_of_pets`.
# Declare three variables, named `first_name`, `is_hungry` and `number_of_pets`.
# Store the appropriate data types in each.
# print all three variables to the terminal.
first_name = "Taryn"
is_hungry = true
number_of_pets = 0
puts first_name
puts is_hungry
puts number_of_pets

# IN WORDS:
# How did you decide to use the data type you did for each of the three variables above?
# How did you decide to use the data type you did for each of the three variables above?

# Explain.
# I used a string for first_name because the value is a word; a boolean for
#is_hungry because logic dictates the value be a true or false statement based
#on the variable's name; and an integer for number_of_pets because logic asks
#for a number, and i didn't want to use the string "zero"


# YOU DO:
# Re-assign the values to the three variables from the previous challenge to
# different values (but same data type).
# Print all three variables to the terminal.

first_name = "My first name is Taryn"
is_hungry = false
number_of_pets = 0.0
puts first_name
puts is_hungry
print number_of_pets

# YOU DO:
# Using the variables below, print the total number of snacks to the terminal:
healthy_snacks = 6;
junk_food_snacks = 8;

puts healthy_snacks + junk_food_snacks

#-------------------
# FINAL CHECK
#-------------------

# Did you run this file in your terminal to make sure everything printed out
# to the terminal as you would expect?
# to the terminal as you would expect?
7 changes: 7 additions & 0 deletions section1/git_homework/thoughts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
take1 = 'I need to improve my faculties for time management and focus.'
take2 = 'Git is a little confusing right now, but I'm not deterred!'

strat1 = 'I will review my notes and materials within 48 hours of writing them to solidify my understanding.'
strat2 = 'I will read code backwards and outloud to help me find mistakes.'

shout = 'Thanks Amy! You've been a great help getting me set up.'
10 changes: 10 additions & 0 deletions section1/reflection.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
## Section 1 Reflection

1. Regarding the blog posts in Part A, how do you feel about asking questions? Do you tend to ask them too soon, or wait too long, or somewhere in between?
i feel pretty at ease with asking questions. in second grade, my teacher nicknamed me the "Queen of Questions". Perhaps I ask questions too soon more often than waiting too long (at work anyway - my personal life is another matter)

2. How would you print the string `"Hello World!"` to the terminal?
puts "Hello World!" in my .rb file, save file, call file in terminal with ruby <filename>.rb (first making sure I was in the correct directory)

3. What character is used to indicate comments in a ruby file?
octothorpe #

4. Explain the difference between an integer and a float?
integers are whole numbers and floats carry out past the decimal (3 - integer vs. 3.14159 - float)

5. In the space below, create a variable `animal` that holds the string `"zebra"`
animal = "zebra"

6. How would you print the string `"zebra"` using the variable that you created above?
puts animal

7. What is interpolation? Use interpolation to print a sentence using the variable `animal`.
interpolation inserts variables into strings, other variables, etc.
puts "#{animal}s have stripes"

8. What method is used to get input from a user?
gets (gets.chomp removes the /n)

9. Name and describe two common string methods:
lower() will convert to lower case; capitalize() will capitalize the first latter
6 changes: 6 additions & 0 deletions section1/rent.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#this is what i owe for rent
puts "Rent total percentage and each owed DJ and TO #{1299 * 0.60 / 2}"
puts "Rent total percentage MW #{1299 * 0.40}"

puts "Amount MW is owed from TO #{1299 / 2 - 1299 * 0.40}"
puts "Amount DJ is owed from TO #{1299 / 2 - 1299 * 0.60 / 2}"
Loading