firstly i want to thatn all you guys for the help on the sorting program
i have a problem that i tried but 'm unable to solve ...
u guys helped a lot in my previous post ..
so please help me now ..
'm using windows
heres my code -
a = [3, 2, 1]
-
b = [7, 5, 3]
-
c = [56, 242, 4]
-
r = [31, 146, 124]
-
-
t = zip(a, b, c, r)
-
print t
-
# [(31, 7, 56, 3), (2, 5, 242, 146), (1, 3, 4, 124)]
-
for i, intTuple in enumerate(t):
-
t[i] = sorted(intTuple)
-
print t
-
# [[3, 7, 31,56], [2, 5, 146, 242], [1, 3, 4, 124]]
-
-
print t[:1]
-
now if i print t[:1]
the output will be
[3,7,31,56]
my problem is ... how can i print the a,b,c,d for the coresponding vectors
i.e
i want to print for the above axample ... [3,7,31,56 ] - [a,b,r,c]
and also print
a
b
c
d
3 1391 bvdet 2,851
Expert Mod 2GB
firstly i want to thatn all you guys for the help on the sorting program
i have a problem that i tried but 'm unable to solve ...
u guys helped a lot in my previous post ..
so please help me now ..
'm using windows
heres my code -
a = [3, 2, 1]
-
b = [7, 5, 3]
-
c = [56, 242, 4]
-
r = [31, 146, 124]
-
-
t = zip(a, b, c, r)
-
print t
-
# [(31, 7, 56, 3), (2, 5, 242, 146), (1, 3, 4, 124)]
-
for i, intTuple in enumerate(t):
-
t[i] = sorted(intTuple)
-
print t
-
# [[3, 7, 31,56], [2, 5, 146, 242], [1, 3, 4, 124]]
-
-
print t[:1]
-
now if i print t[:1]
the output will be
[3,7,31,56]
my problem is ... how can i print the a,b,c,d for the corresponding vectors
i.e
i want to print for the above example ... [3,7,31,56 ] - [a,b,r,c]
and also print
a
b
c
d
Can you provide us with the definition of ' d'?
'm sorry what i meant was the array names ... a b r c
bvdet 2,851
Expert Mod 2GB
firstly i want to thatn all you guys for the help on the sorting program
i have a problem that i tried but 'm unable to solve ...
u guys helped a lot in my previous post ..
so please help me now ..
'm using windows
heres my code -
a = [3, 2, 1]
-
b = [7, 5, 3]
-
c = [56, 242, 4]
-
r = [31, 146, 124]
-
-
t = zip(a, b, c, r)
-
print t
-
# [(31, 7, 56, 3), (2, 5, 242, 146), (1, 3, 4, 124)]
-
for i, intTuple in enumerate(t):
-
t[i] = sorted(intTuple)
-
print t
-
# [[3, 7, 31,56], [2, 5, 146, 242], [1, 3, 4, 124]]
-
-
print t[:1]
-
now if i print t[:1]
the output will be
[3,7,31,56]
my problem is ... how can i print the a,b,c,d for the coresponding vectors
i.e
i want to print for the above axample ... [3,7,31,56 ] - [a,b,r,c]
and also print
a
b
c
d
When you sort each list, they no longer correspond to a,b,c,r. In your example:
t[0] = a,b,r,c
t[1] = a,b,r,c
t[2] = a,b,c,r
To print a,b,c,r for the first item in the list: - print 'a = %d\nb = %d\nc = %d\nr = %d' % (t[0][0], t[0][1], t[0][3], t[0][2])
I cannot tell what you are trying to do.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Daniele Varrazzo |
last post by:
If you need a container to look into, there is the sets module that provides
a couple of them.
If you need a sorted list, there is the bisect module. But i don't think it
fits your need for a...
|
by: MackS |
last post by:
Dear all,
I've got several large sets in my program. After performing several
operations on these I wish to present one set to the user
sorted according to a certain criterion. Is there any...
|
by: Der Andere |
last post by:
I need to implement a sorted (ordered) list. STL has no sorted list type as
far as I know. Is there a (straight) way to implement a sorted list using
STL?
BTW: The type of items in the list will...
|
by: Cybertof |
last post by:
Hi !
I would like to make an array of structure (collection ?) that would
behave like an advanced sorted list : a sorted list with one key but
with multiple values (sorted lists are key/value...
|
by: Olaf Baeyens |
last post by:
I have to load about 10000 possible file names into a list and must have
thems sorted alphabetically, including the file information.
At this moment, in conventional C++, I use a sorted file strng...
|
by: Tom Scales |
last post by:
I've got a new problem (making progress on my GetFiles problem).
I have a need to keep a large number of entries in a SortedList. My
challenge is that there are duplicate entries in the key....
|
by: J L |
last post by:
I want to create a sorted list whose values are themselves sorted
lists. I wrote the following simple test program but it does not
behave as I would expect.
What I wanted to do was have the...
|
by: shrishjain |
last post by:
Hi All,
I need a type where I can store my items in sorted order. And I want to
keep adding items to it, and want it to remain sorted. Is there any
type in .net which I can make use of.
I see...
|
by: Khayrat |
last post by:
Hi folks, please help
I have a xml file with a list of items. The list is sorted during xslt
processing. Based on this sorted list I want a navigation facility to
walk through the sorted list...
|
by: Vik Rubenfeld |
last post by:
I have to search 2 mySQL tables, and show the user a single sorted list
that contains all the results from both mySQL queries.
My question is, how do you get all the resulting items from both...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |