def indexOfLargestInt(listOfInts):
    """
    return index of largest element of non-empty list of ints, or False otherwise

    That is, return False if parameter is an empty list, or not a list
    parameter is not a list consisting only of ints

    By "largest", we mean a value that is no smaller than any other
    value in the list.  There may be more than one instance of that value.
    Example:  in [7,3,7], 7 is largest

    By "index", we mean the subscript that will select that item of the list when placed in []
    Since there can be more than one largest, we'll return the index of the first such value in those cases,
    i.e. the one with the lowest index.

    >>> indexOfLargestInt([])
    False
    >>> indexOfLargestInt('foo')
    False
    >>> indexOfLargestInt([3,5,4.5,6])
    False
    >>> indexOfLargestInt([40])
    0
    >>> indexOfLargestInt([-90,40,70,80,20])
    3
    >>> indexOfLargestInt([10,30,50,20,50])
    2
    >>>
    """

    if type(listOfInts)!=list or listOfInts==[]:
        return False

    # Now we know there is at least one item in the list.
    # We make an initial assumption that this item will be the largest.
    # We then check every other item in the list

    indexOfMaxSoFar = 0    # the one in position zero is the first candidate


    # Note: we have to start from 0 because we need to check the type
    #  of element[0] to see if it is an int.  Otherwise, we could start from 1

    for i in range(0,len(listOfInts)):  # all indexes in the list

       if type(listOfInts[i])!=int:      # make sure it is an int
          return False

       if listOfInts[i] > listOfInts[indexOfMaxSoFar]:  # compare new item
          indexOfMaxSoFar = i  # we have a new candidate

    # Now we've gone through the entire list. If some other index were that
    # of a larger int, we would have changed indexOfMaxSoFar to that.  So
    # what we are left with must be the index of the largest one.

    return indexOfMaxSoFar