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
Auf dieser Seite können Sie das Online-Video How to use Random Module in Python efficiently [Source code available] mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Code with Pranjal Srivastava 29 Juli 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 180 Mal angesehen und es wurde von 6 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!