Created
May 9, 2018 02:33
-
-
Save santosh/ffd870e4c918d946e830403cd2ed4e63 to your computer and use it in GitHub Desktop.
Random module use cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
print(random.sample(range(100), 5)) | |
print(random.sample(["Fish", "Dog", "Cat"], 1)) | |
print(random.choice(["Fish", "Dog", "Cat"])) | |
pets=["Fish", "Dog", "Cat", "Parrot"] | |
random.shuffle(pets) | |
print(pets) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment