I didn't get the "import random" function. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 3

I didn't get the "import random" function.

I still don't understand the "import random" thing and the "random.choice" or the others random commands. Can someone help me?

27th Jul 2018, 11:29 PM
Kisune
Kisune - avatar
1 Réponse
0
Sure! Imagine the "import random" statement as inviting a magician named "random" to your programming party. This magician can help you shuffle things up, pick random items, and add an element of surprise to your code. When you use "random.choice", it's like asking the magician to pull a random rabbit out of a hat full of possibilities. So, in essence, by importing random and using its functions like "random.choice", you're adding a touch of randomness and excitement to your code, just like a magic show!
12th Apr 2024, 8:00 PM
`нттየ⁴⁰⁶
`нттየ⁴⁰⁶ - avatar