Learn how to use the python random module in efficient way #shorts
Source code:
import random
1. random()- Random float number between 0.1 to 1.0
print(random.random())
2. randint()- Random integer between specified integers
print(random.randint(1,20))
3. randrange()- Random integer between specified range
print(random.randrange(1,20,2))
4. choice()- Random value from list
print(random.choice([1,2,3,4,5,6,7,8]))
5. shuffle- Shuffle the order of the items
a=[1,2,3,4,5,6,7,8,9]
random.shuffle(a)
print(a)
6. sample- Random Sample integer
print(random.sample(a,k=2))
If you want to learn more about Python and DevOps, you can get this course-
https://www.udemy.com/course/learn-co...
#python #pythontutorial #pythontipsandtricks #pythontricks #pythonprogramming #pythonshorts #pythonforbeginners #shorts #pythonrandommodule
In questa pagina del sito puoi guardare il video online How to use Random Module in Python efficiently [Source code available] della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Code with Pranjal Srivastava 29 luglio 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 180 volte e gli è piaciuto 6 spettatori. Buona visione!