Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Rstudio 1. create a script that generate a random number (between 1 to 10) (need to research on the correct random function), Display the

Using Rstudio
1. create a script that generate a random number (between 1 to 10) (need to research on the correct random function), Display the number and store it in var1.
2. Run step 1 to generate a second number (say var2). Display the number and add the number to the number in step 1 (var1
3. Use IF statements and run the following: If var1 below 16, repeat step 2. If the number is between 16 and 21, print out a statement "hold" and stop the game. If var1 is above 21, print out a statement "busted" and stop the game.
Include the R code and screenshot of how the code ran.
Is this correct? Help please
image text in transcribed
- Ru 2 3 4 1:1 Source on Save a # Generating the random number between 1 to 10 # using function sample and storing Th vari vari # Generating the random number between 1 to 10 > # using function sample and storing in vari > var1 vari [1] 7 > # Generating another random number between 1 and 10 > var 2 var2 [1] 7 > # Adding the first and second random numbers and storing in vari > varl # Checking the condition if (vari 16) && (var1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 23rd International Conference Dexa 2012 Vienna Austria September 2012 Proceedings Part 1 Lncs 7446

Authors: Stephen W. Liddle ,Klaus-Dieter Schewe ,A Min Tjoa ,Xiaofang Zhou

2012th Edition

3642325998, 978-3642325991

More Books

Students also viewed these Databases questions