In replying to Diana Discussion #Chapter 6.1 Exercise 1 A card is drawn at random from a deck consisting of cards numbered 2 through 10. A player wins 1 dollar if the number on the card is odd and loses 1 dollar if the number if even. What is the expected value of his winnings?

I used the Probability of winning -> is drawing an even card. There are 5 even numbers, therefore I chose choose function with 5

probability_even <- choose(5,1)*choose(4,0)/choose(9,1)

round(probability_even ,4)
## [1] 0.5556

Now we calculate the loss of drawing an odd. We can use 1 - probabiltiy_even

probability_odd <- 1- probability_even

round(probability_odd,4)
## [1] 0.4444

Now we calculate the expected value

E <- 1*probability_even - 1*probability_odd

round(E,4)
## [1] 0.1111