Gruppwebben som samarbetsyta stängs 1 oktober 2026. Då upphör redigeringsmöjligheterna. Du som administratör kan redan nu välja att exportera gruppens innehåll och radera gruppen.
Mer information och instruktioner hittar du i nyheten: Gruppwebben som samarbetsyta stängs 1 oktober 2026.
Random DNA sequences
Write a Python program that prints a random DNA sequence in Fasta format.
Requirements
Your program should ask for the length of the sequence and suggest a reasonable sequence name.
The session should look something like:
$ python randomdna.py Length: 34 >myrandomsequence TGCGCATATTGTCTAACTATGGCTGTGGCCGGA
The output must be in valid Fasta format.
To present:
- Your code and a test run.
Hints
To think about: What distribution do you want for the nucleotides?
The Python module random is suitable to use in this assignment. Take a look at the online documentation the random module! Which function do you find most useful for this assignment?