From a99c982d9c85ba5845699a09544cbb76af80d367 Mon Sep 17 00:00:00 2001 From: Angelina V Date: Mon, 25 Feb 2019 10:50:05 -0500 Subject: [PATCH] added my code --- fizzbuzz.Rmd | 12 ++++++++++++ fizzbuzz.html | 46 ++++++++++++++++++++++++++++++++++++++++++++++ snakesladders.Rmd | 16 ++++++++++++++++ snakesladders.html | 18 +++++++++++++++++- 4 files changed, 91 insertions(+), 1 deletion(-) diff --git a/fizzbuzz.Rmd b/fizzbuzz.Rmd index 58e4ceb..1bb8a50 100644 --- a/fizzbuzz.Rmd +++ b/fizzbuzz.Rmd @@ -45,4 +45,16 @@ for(i in 1:100){ } print(answer) ``` +###Angelina Vasquez Code +```{r} +for(i in 1:100) + if(i%%3==0){ + print("Fizz")} + if(i%%5==0){ + print( "Buzz" ) + }else(i%%3==0 && i%%5==0) + print( "FizzBuzz" ) + + #It did not work the way it was supposed to +``` diff --git a/fizzbuzz.html b/fizzbuzz.html index 7457e94..04c722f 100644 --- a/fizzbuzz.html +++ b/fizzbuzz.html @@ -224,6 +224,52 @@

Matt’s Code

} print(answer) +
+

Angelina Vasquez Code

+
for(i in 1:100)
+  if(i%%3==0){
+    print("Fizz")}
+
## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+## [1] "Fizz"
+
 if(i%%5==0){
+  print( "Buzz" )
+ }else(i%%3==0 && i%%5==0)
+
## [1] "Buzz"
+
  print( "FizzBuzz" )
+
## [1] "FizzBuzz"
+
  #It did not work the way it was supposed to
+
diff --git a/snakesladders.Rmd b/snakesladders.Rmd index 045da5c..8655313 100644 --- a/snakesladders.Rmd +++ b/snakesladders.Rmd @@ -33,4 +33,20 @@ for (i in 1:1000) { avg_moves <- mean(count) print(avg_moves) ``` +###Angelina Vasquez Code +```{r} +save_rolls <- c() +for(sims in 1:1000){ + total_sum<-0 + number_of_rolls<-0 + while(total_sum < 25){ + number_of_rolls <- number_of_rolls+1 + total_sum <-total_sum+sample(c(1,2,3,4,5,6),1) + } + save_rolls[sims] <- number_of_rolls +} +mean(save_rolls) + +#Just used the code you had in the example. Couldn't come up with a solution +``` diff --git a/snakesladders.html b/snakesladders.html index b20f033..a33d3ff 100644 --- a/snakesladders.html +++ b/snakesladders.html @@ -212,7 +212,23 @@

Jeff Kravitz

} avg_moves <- mean(count) print(avg_moves) -
## [1] 8.792
+
## [1] 8.766
+ +
+

Angelina Vasquez Code

+
save_rolls <- c()
+for(sims in 1:1000){
+  total_sum<-0
+  number_of_rolls<-0
+  while(total_sum < 25){
+    number_of_rolls <- number_of_rolls+1
+    total_sum <-total_sum+sample(c(1,2,3,4,5,6),1)
+  }
+  save_rolls[sims] <- number_of_rolls
+}
+mean(save_rolls)
+
## [1] 7.626
+
#Just used the code you had in the example. Couldn't come up with a solution