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
На этой странице сайта вы можете посмотреть видео онлайн How to use Random Module in Python efficiently [Source code available] длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Code with Pranjal Srivastava 29 Июль 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 180 раз и оно понравилось 6 зрителям. Приятного просмотра!