Files
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

13 lines
430 B
Plaintext

// GCContent: the fraction of the letters of S that are G or C. Other letters
// (N for an unknown base, lowercase) count in the length and not in the count.
FUNCTION GCContent(S : STRING) RETURNS FLOAT
REQUIRE LENGTH(S) > 0
DECLARE Count : INTEGER <- 0
FOR I <- 0 TO LENGTH(S)
IF S[I] == 'G' OR S[I] == 'C' THEN
Count <- Count + 1
ENDIF
NEXT I
RETURN Count / LENGTH(S)
ENDFUNCTION