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
On this page of the site you can watch the video online How to use Random Module in Python efficiently [Source code available] with a duration of hours minute second in good quality, which was uploaded by the user Code with Pranjal Srivastava 29 July 2022, share the link with friends and acquaintances, this video has already been watched 180 times on youtube and it was liked by 6 viewers. Enjoy your viewing!