"sith ." wrote:
> How can I determine if the elements in a are larger or smaller than
> the elements in b.
> ..
> like 2 columns in excel, the third column would be
> a new list of boolean values. Can someone help please? Thank you.
Hi,
in that case, you need to crea
sith . wrote:
> Hi,
> I've read the posts on comparing 2 lists and couldn't find the answer to
> my question.
> I have 2 lists
> a = [4,3,2,6,7,9]
> b = [8,6,3,3,2,7]
> How can I determine if the elements in a are larger or smaller than the
> elements in b.
Hi,
I've read the posts on comparing 2 lists and couldn't find the answer to my
question.
I have 2 lists
a = [4,3,2,6,7,9]
b = [8,6,3,3,2,7]
How can I determine if the elements in a are larger or smaller than the
elements in b.
for i in a:
for u in b:
i > u
does not retu
greater !!
greater !!
smaller
only the second and third "greater" and "smaller" output are correct as 1.5
is larger than 1 and 0 is smaller than 1.5.
What is i[1] greater than?
a = [[1,1],[3,1.5],[5,0]]
for i in range(len(a)) :
if a[i][1] > a[i-1][1] :
print 'greater !!'
else:
print "smaller"
greater !!
greater !!
smaller
Thanks for taking the time to help me Aditya. I tried the code but have
encountered a problem. In this new list,
[
a = [[1,2],[3,1.5],[5,6]]
for i in a:
print i
if i[1]>i[0]:
print "second index is larger"
else:
print "second index is smaller"
[1, 2]
second index is larger
[3, 1.5]
second index is small
er
[5, 6]
second index is larger
What I'd like do is compare if 1.
a = [[0,1,2,3,4,5],[1,2,3,4,5,6]]
You cannot modify the same array when you are looping through it. You have to
loop through the copy of the contents :- a[:].
# Untested code
for i in a[:]: # You are looping through the copy of contents
# I'm new I'm going to try and explain my und
newfile = open('y.txt')
>>> for line in newfile:
... print line.rstrip()
3 5 7
11 8 10
Hi,
I'm trying to parse an array. Now that I can open and read lines in my array,
how can I access individual elements of my multidimensional array? I'd like to
loop through the array and comp
Thank you very much Alan.
Kevin
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com ___
Tutor maillist - Tutor@python.org
http://mail.python.org
Hi,
Thanks for your input. I'm presently downloading enthought python - no asian
mirror, so it'll take a really long time to download even on broadband at
10kbps) - but I don't think it's a distro problem. I'm probably not doing it
right as I'm now using IDLE and still have the same problem.
hi,
I'm a beginner. Can someone help me with the installation? I've read several
tutorials, possess a couple of books, and have followed the instructions, but I
stil face a problem. None of the online tutorials address this issue in depth
maybe because it could be too simple. I'm having proble
11 matches
Mail list logo