Arrays

Garland Fulton stackslip at gmail.com
Mon Nov 29 23:55:31 CET 2010


At the top of the last post I didn't understand how I was supposed to have
my e mail headers or my quotes formatted.

I also would like to change the header to my e mail thread. To <LIST NOT
ARRAY>

I appolpgize and thank you for clearing up my thinking. I just got  done
with a java class and I should have paid more attention.

Now that I went back and reviewed.

array[]    // in java
Is not the same as
list[]       // in python.

I will go back and try my way again.

I have a list of objects built to form numbers given to me already. I would
like to take the list apart iterate over each component and replace it with
the corresponding number, and put it back together again everytime I call
that number(str object) to be printed from my list.

To clear my goals up I don't want to be a bad to this e mail list.

Thank you,

Slie
On Nov 25, 2010 8:43 PM, "Dennis Lee Bieber" <wlfraed at ix.netcom.com> wrote:
> On Thu, 25 Nov 2010 14:32:57 -0900, Slie <stackslip at gmail.com> declaimed
> the following in gmane.comp.python.general:
>
>> I have an exercise im working on.
>> I have an array of strings, and I would like to take each peace of the
array and assign it to a new array so I can iterate over each of those
pieces and replace the sting I want then put it back together.
>>
>> I hope that is not too confusing. This is how im trying to solve the
problem.
>>
>> I have a program that takes in integers and it prints out the integers in
bigger ones made up of asterisks. Im supposed to alter the program so so
that instead of asterisks it prints them in bigger ones made up of the
number itself.
>>
>> I am given arrays built to look like the numbers, already.
>
> {Note: this newsgroup/list prefers the "trim and follow" method of
> quoting; persist ant "top-posting" will earn the ire of the readers}
>
> We still have the problem that you are referring to "arrays" which
> are NOT native data types in Python... There is an importable module for
> "arrays", and most of the numerics packages (a la numpy) define arrays,
> but Python itself has dynamically sized "lists" (and "lists of lists..."
> to add additional dimensions).
>
> Off-hand, it sounds like you are just substituting a list-of-lists
> (of strings) of asterisks with a list-of-lists containing characters of
> each digit...
>
> Now which part are you having problems with? Extracting the digits
> from the input "number", indexing into the list of digit data, indexing
> into the row of digit data, collecting the data into one output
> structure?
>
> I'm probably giving away too much here but using just 0/1 and input
> as a string...
>
> -=-=-=-=-=-
>
> digits = [ [ " 000 ",
> "0 0",
> "0 0",
> "0 0",
> "0 0",
> " 000 " ],
> [ " 1 ",
> " 11 ",
> " 1 ",
> " 1 ",
> " 1 ",
> " 111 " ] ]
>
> output = []
>
> DATA = "01101"
>
> for row in range(6):
> rowparts = []
> for d in DATA:
> dint = int(d, 10)
> rowparts.append(digits[dint][row])
> output.append(" ".join(rowparts))
>
> print output
> print
>
> for rout in output:
> print rout
> -=-=-=-=-=-=- (use fixed width font to view)
> [' 000 1 1 000 1 ', '0 0 11 11 0 0 11
> ', '0 0 1 1 0 0 1 ', '0 0 1 1 0 0 1
> ', '0 0 1 1 0 0 1 ', ' 000 111 111 000 111
> ']
>
> 000 1 1 000 1
> 0 0 11 11 0 0 11
> 0 0 1 1 0 0 1
> 0 0 1 1 0 0 1
> 0 0 1 1 0 0 1
> 000 111 111 000 111
>
> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfraed at ix.netcom.com HTTP://wlfraed.home.netcom.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101129/c92cba3f/attachment.html>


More information about the Python-list mailing list