Sequence Report Card

Foundational Python Foundations Python Variables Basic I/O String Formatting
Significance:

Before you can analyse a sequence you have to be able to read it in, hold it in a
variable, and print something useful about it. This is the smallest complete program in bioinformatics:
input, a couple of derived values, formatted output. Getting comfortable with f-strings and basic
arithmetic here is what makes every later problem readable rather than a wall of string concatenation.

Statement

Read a sequence identifier on the first line and a DNA sequence on the second line.

Print a three-line report:

ID: <identifier>
Length: <number of bases>
First base: <the first character of the sequence>

Match the labels and spacing exactly as shown.

Input — read from standard input
Variable Type Description
identifier
line 1
str The sequence identifier
1 <= len(identifier) <= 50, no spaces
seq
line 2
str The DNA sequence
1 <= len(seq) <= 1000, uppercase A, C, G, T only

These variables are already read for you in the starter code on the right.

Output

str three labelled lines reporting the identifier, sequence length, and first base

Sample Cases
Sample 1
Input
BRCA1_exon2
ATGGATTTATCTGCTCTTCG
Expected Output
ID: BRCA1_exon2
Length: 20
First base: A
A twenty-base sequence beginning with A.
Sample 2
Input
seq1
G
Expected Output
ID: seq1
Length: 1
First base: G
A single-base sequence.

Submit also runs your code against 3 hidden test cases. Hidden inputs are never shown — if one fails you'll get its number and a description of the mismatch, not the data.

Constraints
  • The identifier contains no spaces
  • 1 <= length(seq) <= 1000
  • Labels must appear exactly as ID:, Length: and First base: with a single space after each colon
Further Reading
  • len() gives the sequence length in one call.
  • Indexing with seq[0] retrieves the first character.
  • An f-string such as f"ID: {identifier}" keeps the formatting readable.

My Notes
Log in to save personal notes.
Console output will appear here when you click Run Code or Submit...
Expected: identifier (str), seq (str)
Next Problem
Filter Sequences by Length