last day (79 days later) » 
05:00 - 12:0012:00 - 14:00

12:00 PM
Why not? You can't assume where to. Oh.
Like... [2:2]? No, that makes no sense.
 
return sequence[0:index]+nuclide+ ???
so what would the last part be? ;p
 
@JourneymanGeek [index:]
 
lol
thats smarter than what I did
 
Yeah?! But is it right?!
 
I believe so, let me test that ;p
 
12:01 PM
I am proud!!! :DDD
 
ugh, idle crashed
 
:OO
Do you want me to test it?
 
please do
 
It doesn't like the : for some reason. It thinks it's an Syntax error.
 
o0
works for me
 
12:04 PM
Huh. Maybe I did something wrong.
 
you probably missed something, take a good look at the line
 
return sequence[0:index]+nucleotide+[index:]
I hate the word nucleotide.
 
ehsy
lol
i used dna1 and dna2
that LOOKS ok
 
Maybe I need to do sequence[index:]
Let me try.
Works :)
 
lol
ya ;p
I missed that
 
12:08 PM
Woot!
So the complement of a nucleotide can be achieved through a variable, right? Like G=C
 
er for that using return will work
since you only need to return one value
if "A"
return "T"
elif "T"
and so on
 
But return ends the statement. Therefore I should use a variable, right?
 
well no
since all the module does is take one value, and return another
I mean you COULD do it with a variable
 
So if if 'A' is incorrect, it moves to elif and doesn't look at return?
@JourneymanGeek Whatever's easiest XD
room topic changed to Python Programming: For those who need help programming, coding and using Python [code-blocks] [programming] [python] [python-2.7] [python3]
room topic changed to Python Programming: For those who need help programming, coding and using Python. [code-blocks] [programming] [python] [python-2.7] [python3]
 
ya
one line difference
 
12:19 PM
Does this look OK?
  if 'A':
        return 'T'
    elif 'T':
        return 'A'
    elif 'G':
        return 'C'
    elif 'C':
        return 'G'
Hey, return does end it.
All of them return as 'T'.
@JourneymanGeek
 
the elifs are too indented
 
Ahhhh. I see
Actually, they aren't.
I'm very sure return ends it. @Mahesh told me ;P
 
hm
if what is A?
it needs to be if variable == 'A'
 
>.>
 
I have no idea how what you just did even works ;p
 
12:27 PM
sdjhfjksgbjkvs
 
works now?
 
Hold on, i took a few wrong turns.
Trying to do if Function(parameter) is not a good idea.
@JourneymanGeek No. I tried parameter=nucleotide and then if parameter('A') but it says:
 
could you paste your code here?
 
`Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    get_compliment('A')
  File "<pyshell#2>", line 16, in get_compliment
    if parameter('A'):
TypeError: 'str' object is not callable`
 
wait. = ?
 
12:34 PM
 def get_compliment(nucleotide):
        '''(str) -> str

        Returns the complement nucleotide of the one in the parameter.

        >>>get_compliment('A')
        'T'
        >>>get_compliment('G')
        'C'
        >>>get_compliment('C')
        'G'
        >>>get_compliment('T')
        'A'
        '''
        parameter=nucleotide
        if parameter('A'):
            return 'T'
        elif parameter('T'):
            return 'A'
        elif parameter('G'):
            return 'C'
        elif parameter('C'):
That is the function --^
 
    if nucleotide == 'A':
        return 'T'
    elif nucleotide == 'T':
        return 'A'
    elif nucleotide == 'G':
        return 'C'
    elif nucleotide == 'C':
        return 'G'
    else:
        return None
 
Yeah?
 
why parameter = nucliotide?
why are you assigning the value nucleotide to parameter then comparing that value with something, when you already assign a value when calling the function?
 
Because it had an error. I thought that was the answer :P
@JourneymanGeek That's... a very confusing statement. I thought that if I put the value of nucleotide into a variable, it might not get confused and say a string is not callable.
 
lol
its about as confusing as the code >_>
KISS
You take in a value when you call the function
 
12:37 PM
@JourneymanGeek Kiss to you too? ^o^
 
you then compare the value you already took to another value
 
@JourneymanGeek Oh...kay?
 
no variable assignment needed
 
@JourneymanGeek Only statement I could understand. Noted.
 
drop the first line, replace 'paramater' with nucleotide
and you are cooking with gas
 
12:38 PM
@JourneymanGeek nucleotide=nucleotide? That's useless, that's like saying "Apple is apple".
 
"Eat an apple. By that I mean, apple that is apple."
 
drop the parameter=nucleotide line
its not needed
 
@JourneymanGeek I did.
 
then the REST you replace
 
12:39 PM
@JourneymanGeek Noted :))
get_complimentary_sequence.
Hm.
 
you already set a value to nuclide when you call def get_compliment(nucleotide):
lol
 
For get_complimentary_sequence, I would use the thing I just wrote to get the complimentary letter for each one, and slice and replace?
 
not slice
 
index?
 
well might work
lol
I used another method
how would you use slice/index to do this?
 
12:42 PM
-shrug-
 
lol
flow!
 
I kind of want to think of 'cut', but then I just never -paste-
 
lol
well you have a string. You want to look at each charecter , then replace it with something
 
What fun.
 
but you can't change a string directly, you would need to assign the output as a variable.
 
12:44 PM
@JourneymanGeek You'll need to help me with this.
 
ok.. first we'd start with for char in dna:
since we want to run though each charecter in the string
then we need to fund each char's compliment, so in that loop, we run c = get_complement(char)
 
Just wait, I haven't created the function yet.
 
but that will only output single charecters, we want a string
lol
do it, you will need it
>_>
 
@JourneymanGeek Ok...
 
lol
want me to continue?
 
12:48 PM
Yeah, ty.
 
when we run c =get_compliment(char) we only get individual charecters
 
And we need to make them into a string.
 
so what we'd do is use another variable to do that newdna = newdna + c
but we'd need to set an initial value outside the loop.
so.. putting all that together
  newdna=''
        for char in dna:
            c = get_complement(char)
            newdna = newdna + c

        return newdna
we initialise newdna as a blank value, then run through each charecter in dna, find its compliment, then concatenate its value to newdna, once that is done, we return newdna
^ thats the 'flow'
 
It says:
Traceback (most recent call last):
  File "<pyshell#18>", line 1, in <module>
    get_complimentary_sequence('AT')
  File "<pyshell#17>", line 15, in get_complimentary_sequence
    c = get_complement(char)
NameError: global name 'get_complement' is not defined
 
...
check my spelling
 
12:53 PM
Oh. -.-
My spelling is wrong -.-''
 
lol
idle needs spellcheck ;)
you DO know you can tab-complete functions right?
 
-.- no
 
(and yes, I see the 'function' as a mental flowchart ;))
 
Um, it says 'T' and 'T' only (when 'TA' is there)
 
12:56 PM
@JourneymanGeek That's inspiring. Probably very useful, too. I think of it as instructions :3
 
are your variables correct?
 
Here
def get_complementary_sequence(dna):
    '''(str) -> str

    Returns the complementary sequence in a string.

    >>>get_complementary_sequence('AT')
    'TA'
    >>>get_complementary_sequence('AATTCCGG')
    'TTAAGGCC'
    >>>get_complementary_sequence('ACGT')
    'TGCA'
    '''
    newdna=''
    for char in dna:
        c = get_complement(char)
        newdna = newdna + c

        return newdna
 
we're using different variable schemes
...
indents ;p
your return newdna is in the same loop as the for char in dna
 
12:58 PM
Do I need to remove the paragraph?
 
indent EVERYTHING from newdna = '' to newdna = newdna + c by one tab
 
OHHH ty
This?
 
dogwalkingtime, will be gone after the last one
er no
 
Does return need to be indented also?
Ah. I see. TY
 
1:02 PM
@JourneymanGeek Thanks for all your help!! Everything is now fine! Enjoy walking your dog. Anytime you need me, I'll try my best to help ^o^
@JourneymanGeek Bye~
Is leaving also
 
05:00 - 12:0012:00 - 14:00

  last day (79 days later) »