
December 25th, 2012, 02:37 AM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 2
Time spent in forums: 52 m 10 sec
Reputation Power: 0
|
|
|
Outout of array
I've few questions.
1. How to generate float numbers in an array?
I use something like that
Code:
import array
import random
a=array.array('i',(random.randint(-50,51) for i in xrange(10)));
print a
This gives integer [-50; 50], but how to get float, for example, [-1, 1], not [-1, 1)?
2. How to output array in columns?
For example, I have generated array and I want to make output in 3 columns, how can I do it?
3. How to output array in rows?
Same that with columns, but, for example, in 10 rows.
|