Try this:
from random import choice
print(choice([i for i in range(0,9) if i not in [2,5,7]]))
More Related Contents:
- How can I randomly select an item from a list?
- How do I create a list of random numbers without duplicates?
- Generate random integers between 0 and 9
- random.seed(): What does it do?
- Generate a random date between two other dates
- Generating a list of random numbers, summing to 1
- Consistently create same random numpy array
- How to generate a random number with a specific amount of digits?
- How can one continuously generate and track several random objects with a time delay in pygame? [duplicate]
- Python random sample with a generator / iterable / iterator
- Read a small random sample from a big CSV file into a Python data frame
- Random row selection in Pandas dataframe
- How to generate random numbers that are different? [duplicate]
- Sampling uniformly distributed random points inside a spherical volume
- How to generate random strings in Python?
- Binary random array with a specific proportion of ones?
- How can I create a random number that is cryptographically secure in python?
- Difference between np.random.seed() and np.random.RandomState()
- Should I use `random.seed` or `numpy.random.seed` to control random number generation in `scikit-learn`?
- Create random list of integers in Python
- How do I simulate flip of biased coin?
- Python: Random selection per group
- Sample each group after pandas groupby
- Generating Discrete random variables with specified weights using SciPy or NumPy
- How to hash a string into 8 digits?
- Python – shuffle only some elements of a list
- Random non overlapping circles(with circle number controlled) in python and pygame
- TensorFlow: Non-repeatable results
- Can I generate authentic random number with python?
- Generate random array of floats between a range