What is wrong with the variable comparison in this one?

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

It gives me a syntax error at line 4, but it seems fine to me. What is wrong?
<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>
File “python”, line 4
for x < len(DNA):
^
SyntaxError: invalid syntax

<What do you expect to happen instead?>

```python

RNA=
def transcription(x):
DNA=raw_input(“Please enter DNA sequence:”)
for x < len(DNA):
if DNA(x)!=(“A” or “T” or “C” or “G”):
print “This sequence is invalid.”
transcription(x)
elif DNA(x)==“A”:
RNA.append(“U”)
elif DNA(x)==“T”:
RNA.append(“A”)
elif DNA(x)==“C”:
RNA.append(“G”)
else:
RNA.append(“C”)
print RNA
transcription(0)

<do not remove the three backticks above>

This does not look right. Did you mean to write,

for x in range(len(DNA):

?

This does not look right, either.

if DNA[x] not in "ATCG":

Pretty sure this is not a lesson in the Python track. Please post a link to this exercise.

It is not actually an exercise… Is that what this forum is about? I thought it was a general purpose forum for programming.
And yeah, I realised the 2nd point myself. Thanks for the 1st, though- this one went right over my head.
Now, I got a new problem though. WOuld you mind checking it out? I’m a PITA, I know, but I just cannot figure this out.

File “python”, line 20
if (len(RNA) mod 3) == 0:
^
SyntaxError: invalid syntax

RNA=
def transcription(x):
DNA=raw_input(“Please enter DNA sequence:”)
for x in range(len(DNA)):
if DNA==“G”:
RNA.append(“C”)
elif DNA==“A”:
RNA.append(“U”)
elif DNA==“T”:
RNA.append(“A”)
elif DNA==“C”:
RNA.append(“G”)
else:
print “This sequence is invalid.”
del RNA[ : ]
transcription(0)
print “The resulting RNA has the sequence:”
print “”.join(RNA)
def translation(y):
if (len(RNA) mod 3) == 0:
y=raw_input(“is your chosen genome mature? Please type Yes or No.”)
if y==“Yes”:
z=1
codon=
peptide=
codon.append(RNA[0])
codon.append(RNA[1])
codon.append(RNA[2])
if codon!=[“A”,“U”,“G”]:
print “This RNA is not translatable.”
else:
peptide.append(“Met”)
for z in range(len(RNA)/3):
codon.append(RNA[3z])
codon.append(RNA[3
z+1])
codon.append(RNA[3*z+2])
if codon==[“A”,“A”,“A”] or [
transcription(0)

That would be Corner Bar, where I’ll be moving this topic. These forums are dedictated to the course track modules.[quote=“betawhiz90565, post:3, topic:52326”]
if (len(RNA) mod 3) == 0:
[/quote]

if len(RNA) % 3 == 0:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.