Challenge: 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
repeatloop 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?
Grazie per i tuoi commenti!
Sezione 2. Capitolo 6
single
Chieda ad AI
Chieda ad AI
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?
Fantastico!
Completion tasso migliorato a 5.56
Challenge: 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
repeatloop 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?
Grazie per i tuoi commenti!
Sezione 2. Capitolo 6
single