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 :: Syntax of Opening a File in python 
Python :: Python difference between filter and map 
Python :: extracting values in pandas 
Python :: free wifi connection disconnects frequently windows 10 
Python :: for each in python 
Python :: remove emoji 
Python :: seaborn stripplot range 
Python :: puython is not equal to 
Python :: keras.callbacks.History 
Python :: python string replace by index 
Python :: how to create a User and User profile in django rest framework 
Python :: spliting the text to lines and keep the deliminaters python 
Python :: how to check if all values in list are equal python 
Python :: pip vs conda 
Python :: how to run python code in python 
Python :: additionner liste python 
Python :: how to add axis labels to a plotly barchart 
Python :: division of 2 numbers in python 
Python :: python isdigit 
Python :: search and replace in python 
Python :: break input loop 
Python :: tensorflow 
Python :: python regex (d)(?=d1) 
Python :: python global variable unboundlocalerror 
Python :: are logN and (lognN) same 
Python :: pytest fixture 
Python :: how to split python string into N numbers equally 
Python :: install web3 on python 
Python :: simple python program for beginners 
Python :: .corr python 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =