Challenge: 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
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.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 6
single
Pregunte a AI
Pregunte a AI
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?
Genial!
Completion tasa mejorada a 5.56
Challenge: 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
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.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 6
single