Python’s random module makes it extremely easy to generate random DNA bases.
import random dna = ["A","G","C","T"] #output a random base print(random.choice(dna))
Now to generate a specific number of random bases, all we have to do is use Python’s range function: