HELP Newbie solve this Problem
Felix Thibault
felixt at dicksonstreet.com
Sat Mar 25 02:15:03 EST 2000
Are 10, 20, and 30 continuations ?
At 21:10 3/23/00 -0800, Dennis Lee Bieber wrote:
>On Fri, 24 Mar 2000 03:43:38 GMT, race9047 at my-deja.com declaimed the
>following in comp.lang.python:
> I must be from a different world then... The second part is what
>I'd find easy... even in FORTRAN (maybe too easy in FORTRAN)
>
> integer counts(26) / 26 * 0 / ! or is it 0 * 26?
> character line*132 ! set for the longest line the
> ! the data file can contain
> open(10, file="data", status="old")
> read(10, '(a132)', iostat=ios) line
> 10 continue
> if (ios .eq. 0) then
> do 20 i=1, 132 ! or the line length max
> if (line(i:i) .ge. 'a' .and. line(i:i) .le. 'z') then
> inx = ichar(line(i:i)) - ichar('a') + 1
> counts(inx) = counts(inx) + 1
> elseif (line(i:i) .ge. 'A' .and. line(i:i) .le. 'Z')
> x then
> inx = ichar(line(i:i)) - ichar('A') + 1
> counts(inx) = counts(inx) + 1
> else
> continue ! just my style
> endif
> 20 continue
> read(10, '(a132)', iostat=ios) line
> goto 10
> endif
> close(10)
> do 30 i=1, 26
> print *, char(i), ' ', counts(i)
> 30 continue
> stop
>
>
> It would look much cleaner in Python, and I'd use case
>conversion modules rather than the duplicates in the IF statements...
>
>
>--
> > ============================================================== <
> > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> > wulfraed at dm.net | Bestiaria Support Staff <
> > ============================================================== <
> > Bestiaria Home Page: http://www.beastie.dm.net/ <
> > Home Page: http://www.dm.net/~wulfraed/ <
>--
>http://www.python.org/mailman/listinfo/python-list
>
>
More information about the Python-list
mailing list