Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Random Number Generator | R Loops Tutorial
Control Flow in R

bookChallenge: Random Number Generator

Tarea

Swipe to start coding

Write a function that generates random numbers between 0 and 1 until one is greater than 0.95, returning the number of attempts needed.

  • Start a counter for the number of attempts.
  • Use a repeat loop to generate a random number between 0 and 1.
  • If the random number is greater than 0.95, exit the loop.
  • Return the total number of attempts.

Solución

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 6
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

Suggested prompts:

Can you explain this in more detail?

What are the main benefits or drawbacks?

Can you give me an example?

close

bookChallenge: Random Number Generator

Desliza para mostrar el menú

Tarea

Swipe to start coding

Write a function that generates random numbers between 0 and 1 until one is greater than 0.95, returning the number of attempts needed.

  • Start a counter for the number of attempts.
  • Use a repeat loop to generate a random number between 0 and 1.
  • If the random number is greater than 0.95, exit the loop.
  • Return the total number of attempts.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 6
single

single

some-alt