Skip to content

Instantly share code, notes, and snippets.

View justuseapen's full-sized avatar

Justus Eapen justuseapen

View GitHub Profile
characters = {
"Tyrion Lannister" => "House Lannister",
"Jon Snow" => "Night's Watch",
"Hodor" => "House Stark",
"Stannis Baratheon" => "House Baratheon",
"Theon Greyjoy" => "House Greyjoy"
}
characters.each do |character, org|
puts "#{character} represents #{org}."
favorite_movies = [
{ title: 'The Big Lebowski', year_released: 1998, director: 'Joel Coen', imdb_rating: 8.2 },
{ title: 'The Shining', year_released: 1980, director: 'Stanley Kubrick', imdb_rating: 8.5 },
{ title: 'Troll 2', year_released: 1990, directory: 'Claudio Fragasso', imdb_rating: 2.5 }
]
favorite_movies.each_with_index do |movie , index|
title = movie[:title]
year = movie[:year_released]
puts "#{year}: #{title}"
puts "How much $ is due?"
cost = gets.chomp.to_f
puts "How much has been tendered?"
tendered = gets.chomp.to_f
if tendered < cost
puts "The customer needs to pay you more dough, bro."
else
change = tendered - cost
require 'pry'
require 'csv'
# class Product
# @@all = []
# def initialize (item, price)
# @item = item
# @price = price
# end
require 'pry'
require 'csv'
def prompt(query)
puts query
gets.chomp
end
def get_data
item = prompt "What is the name of the item?"
puts "What would you like to say?"
phrase = gets.chomp
def playback(phrase)
puts "You said: #{phrase}"
end
playback(phrase)
puts "What would you like to say?"
phrase = gets.chomp
def playback(phrase)
if phrase == "Nothing!"
puts "OK, fine!"
elsif phrase == "I have a lot to say."
puts "Ain't nobody got time for that!"
else
puts "You said: #{phrase}"
puts "What would you like to say?"
phrase = gets.chomp
def lots_to_say
phrases = []
puts "Ok, let's hear it!"
input = ""
while input != "done"
input = gets.chomp
if input == "done"
puts "What would you like to say?"
phrase = gets.chomp
def lots_to_say
phrases = []
puts "Ok, let's hear it!"
input = ""
while input != "done"
input = gets.chomp
if input == "done"
puts "What would you like to say?"
phrase = gets.chomp
def lots_to_say
phrases = []
puts "Ok, let's hear it!"
input = ""
while input != "done"
input = gets.chomp
if input == "done"