Write the number 56 in words.
# install.packages("english")
library(english)
## Warning: package 'english' was built under R version 4.5.2
words(56)
## [1] "fifty-six"
In a game, a 20c coin and a 50c coin are tossed at the same time. To win the game, you must get one head and one tail. What is the probability of winning?
coin1 <- c("Heads","Tails") # 20c coin
coin2 <- c("Heads","Tails") # 50c coin
counter <- 0
N <- 1e5
for (i in 1:N) {
toss1 <- sample(x = coin1,size = 1,replace = T)
toss2 <- sample(x = coin2,size = 1,replace = T)
if (toss1 != toss2) {
counter <- counter + 1
}
}
probability <- counter / N
cat("The probability of winning is:",probability,"\n")
## The probability of winning is: 0.50017