Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

return the biggest even fro a list python

b=[10,30,40,88,77,99,12515,365,959,48,8595,95,9,59,59,5,9,9,49,5,548485844842]
def is_even(lis) :
    i=len(lis)-1
    lis.sort()
    while max(lis)%2!=0:
        i=i-1
        if lis[i]%2==0:
            break
    return lis[i]
print(is_even(b))

Comment

python how to find the highest even in a list

def highest_even(li):
  evens = []
  for item in li:
    if item % 2 == 0:
      evens.append(item)
  return max(evens)

print(highest_even([10,2,3,4,8,11]))


# Building a function to find the highest even number in a list
Comment

PREVIOUS NEXT
Code Example
Python :: how to duplicate a list in python 
Python :: transformer in pytorch 
Python :: Fill in the empty function so that it returns the sum of all the divisors of a number, without including it. A divisor is a number that divides into another without a remainder. 
Python :: IndexError: list assignment index out of range 
Python :: show columns with nan pandas 
Python :: average python 
Python :: sum of diagonal numpy 
Python :: pine script to python 
Python :: how to run a python package from command line 
Python :: find the range in python 
Python :: python call function by string 
Python :: lineplot in plt 
Python :: python elif 
Python :: dictionaries in python 
Python :: using comma as the thousand separator 
Python :: python create empty list 
Python :: how to sum only the odd values in python 
Python :: read header of csv file python 
Python :: pandas explode 
Python :: how to use underscore in python 
Python :: part of a flower 
Python :: turtle write function in turtle package python 
Python :: dataframe partition dataset based on column 
Python :: speed typing test python 
Python :: number pattern program in python using for loop 
Python :: how to get value_counts() order 
Python :: get linkinstance revit api 
Python :: configure your keyboards 
Python :: ist comperension python 
Python :: python event start from file funcion 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =