[Python] have a little error im not able to figure out [closed]

Discussão em 'Python' iniciado por Stack, Fevereiro 15, 2025.

  1. Stack

    Stack Membro Participativo

    IndentationError: unindent does not match any outer indentation level return( (n[y] + n[y-1]) /2 ) Line 21 (Solution.py)

    Got the perfect solution on colab but leetcode is kinda not happy i guess.

    class Solution(object):
    def findMedianSortedArrays(self, nums1, nums2):
    """
    :type nums1: List[int]
    :type nums2: List[int]
    :rtype: float
    """
    n=nums1+nums2

    for i in range (len(n)-1):
    if n>n[i+1]:
    z=n
    n=n[i+1]
    n[i+1]=z
    if len(n)%2!=0:
    y=int(len(n)/2)
    return(n[y])

    else:
    y=int(len(n)/2)
    return( (n[y] + n[y-1]) /2 )

    Continue reading...

Compartilhe esta Página