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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title> DBC Medical Exam </title> | |
</head> |
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
# INITIAL CODE: | |
# ------------- | |
class Boggle | |
def initialize(dice_grid) | |
@board = dice_grid | |
end | |
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
=begin | |
Hey, thanks for taking the time to help. | |
I was under the impression that a defined method could see variables outside of the method. | |
My original attempt to solve this problem was (example 1), where the variable star = "*" was defined outside the method. | |
I understand that having a method variable defined in the method is more practical for reusing the method. | |
But I was curious why it wouldnt work. |
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
def mean(array) | |
sum = 0 | |
array.each do |x| | |
sum += x | |
end | |
mean = sum / array.length |