<jupyter_start><jupyter_text>Given an array of integers, return a new array such that each element at index i of the new array is the product of all thenumbers in the original array except the one at i.For example, if our input was [1, 2, 3, 4, 5], the expected output would be [120, 60, 40, 30, 24]. If our input was [3, 2, 1],the expected output would be [2, 3, 6].Follow-up: what if you can't use division?<jupyter_code>#METHOD 1
def newArray(li):
    ll=[]
    for i in range(len(li)):
        multiply=1
        for j in range(len(li)):
            if li[i]!=li[j]:
                multiply=multiply*li[j]
        ll.append(multiply)
        
    return ll

li=[int(x) for x in input().split()]
ll=newArray(li)
print(ll)
## METHOD 2

def newArray(li):
    ll=[]
    multiply=1
    
    for i in range(len(li)):
        multiply=multiply*li[i]
        
    for ii in range(len(li)):
        ll.append(multiply//li[ii])
        
    return ll

li=[int(x) for x in input().split()]
ll=newArray(li)
print(ll)
        
    
#method3

def prefix(li,targ):
    if targ!=0:
        multiply=1
        for i in range(0,targ,1):
            
            multiply*=li[i]
            
        return multiply
    
    else:
        return 1
    
    
def suffix(li,targ):
    if targ!=(len(li)-1):
        
        multiply=1
        
        for j in range(targ+1,len(li),1):
            
            multiply*=li[j]
            
        return multiply
    
    else:
        return 1
            
def newArray(li):
    llp=[]
    lls=[]
    ll=[]
    for k in range(len(li)):
        llp.append(prefix(li,k))
        lls.append(suffix(li,k))
        
    for z in range(len(li)):
        ll.append(llp[z]*lls[z])
        
    return ll


li=[int(x) for x in input().split()]
ll=newArray(li)
print(ll)<jupyter_output>1 2 3 4 5
[120, 60, 40, 30, 24]
{'fraction_non_alphanumeric': 0.12967986977753662, 'fraction_numerical': 0.02875746066196419, 'mean_word_length': 1.9177215189873418, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '401227', 'license': 'Apache-2.0', 'n_tokens_mistral': 703, 'n_tokens_neox': 656, 'n_words': 191, 'path': 'Daily_Coding_Problem#2.ipynb', 'repo_name': 'priyanshu-coder/Coding-Practise', 'size': '1843'}