import random
def random_char(y):
    alphabet = ['A', 'T', 'C', 'G']
    return ''.join(random.choice(alphabet) for x in range(y))

n=20
k=10
for i in range(0,n):
    print(random_char(k))

Output:

TCTGTTCCAG
GACTAATACA
AGAACTAAGT
CCTCACCATG
GACTTCCAGG
CTGAGGCTTG
TGAGACAGAG
GATCTACCGA
TCAAACTAAT
ATCCGATCTT
GAGGCACTCC
AACCGAATGT
CTCACTGTTC
GTCCCTGGGA
CGTGGTCCAA
AGCCCGATGA
CCTTCTCTCA
GGCCGCTCGT
CACCGGAGTG
GAAGTGACGA

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading