Dave Angel writes:
> Ben is right, dunder methods don't belong in introductory texts.
[…]
> But he didn't show you the simplest fix:
>
> (-3).__abs__()
I disagree; the simplest fix is not to call that method directly, and
just use::
abs(-3)
--
\ “Computer perspective on Moore'
Jim Byrnes Wrote in message:
> I am reading Practical Programming - An Introduction to Computer Science
> Using Python 3. They give this example:
>
> >>> abs(-3)
> 3
>
> >>> -3 .__abs__()
> 3
>
Ben is right, dunder methods don't belong in introductory texts.
And they seldom should be ca
Jim Byrnes writes:
> I am reading Practical Programming - An Introduction to Computer
> Science Using Python 3. They give this example:
>
> >>> abs(-3)
> 3
>
> >>> -3 .__abs__()
> 3
That's a poor example, in my opinion. It's not good for an introductory
text to show calling dunder methods like
I am reading Practical Programming - An Introduction to Computer Science
Using Python 3. They give this example:
>>> abs(-3)
3
>>> -3 .__abs__()
3
When I try it in idle or a terminal I get different results.
Python 3.3.5 (default, Mar 12 2014, 02:09:17)
[GCC 4.6.3] on linux
>>> abs(-3)
3
>
On 23Mar2014 17:28, Mustafa Musameh wrote:
> Hi;
> I have a file that looks like this:
> >title 1
> AAATTTGGGCCCATA...
> TTAACAAGTTAAAT
> >title 2
> AAATTTAAACCC
> ATATATATA
>
>
> I wrote the following to count the As, Cs, Gs anTs for each title I wrote the
> following
>
> import sys
>
> f
On 23/03/14 06:28, Mustafa Musameh wrote:
Hi;
I have a file that looks like this:
>title 1
AAATTTGGGCCCATA...
TTAACAAGTTAAAT…
>title 2
AAATTTAAACCC…
ATATATATA…
…
I want to get the following out put:
>title
234
>title 1
3453
….
Your example data and example output don't match - at
On 03/23/2014 07:28 AM, Mustafa Musameh wrote:
Hi;
I have a file that looks like this:
title 1
AAATTTGGGCCCATA...
TTAACAAGTTAAAT…
title 2
AAATTTAAACCC…
ATATATATA…
…
I wrote the following to count the As, Cs, Gs anTs for each title I wrote the
following
import sys
file = open('file.fna'
Hi;
I have a file that looks like this:
>title 1
AAATTTGGGCCCATA...
TTAACAAGTTAAAT…
>title 2
AAATTTAAACCC…
ATATATATA…
…
I wrote the following to count the As, Cs, Gs anTs for each title I wrote the
following
import sys
file = open('file.fna')
data=file.readlines()
for line in data:
li