dimanche 6 décembre 2015

If statement for all values in list python

Hi my name is Paul Im starting with python and with stackoverflow.com :) I wonder how to get if statements for all list indexes

#a = int(input("a "))
a = [10,10,10]
#b = int(input("b "))
b = [100,10,10]
#c = int(input("c "))
c = [10,10,10]
#d = int(input("d "))
d = [100,10,10]

for itema in a:
    print itema
for itemb in b:
    print itemb
for itemc in c:
    print itemc
for itemd in d:
    print itemd

if itema>=itemd:
    print "make math equation nr.1"
elif itemb<itemd:
    print "make math equation nr.2"

I try to check my condition through all elements in list and get list with results. Which technics should I use ?

Aucun commentaire:

Enregistrer un commentaire