Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Random Number Generator | R Loops Tutorial
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Control Flow in R

bookChallenge: Random Number Generator

Compito

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.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 6
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

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

Scorri per mostrare il menu

Compito

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.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 6
single

single

some-alt