First part:- Given a sorted array and a target value, return the index : '''
class Solution(object):
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""

    print target
    print nums
    for i in nums:
        print i
        if i==target:
            return nums.index(i)
            
        else:
             if i>=target:
                nums.append('target')-----[1](How to append the target here 
                                               before the 'i' element to which 
                                               compared)
                    
                else:
                    nums.append('target')
                    
            print False
'''
Second Part:- If not, return the index where it would be if it were inserted in order ?

I think I solved the first part but I am struggling to make second part of appending work. Can anyone guide ?