Determing whether a list can be splitted into two lists that are reversed sorted and sorted respectively(python)

Here is the link to my solution-

I have passed all test cases but one.

plss help me

Hey @sanchit123manchanda, your link doesn’t show any code. Plz share the correct link.

n = int(input())
l = []
for i in range(n):
a = int(input())
l.append(a)

def is_sorted(l):
for i in range(0,len(l)-1):
if l[i]>l[i+1]:
return False
return True

def is_rsorted(l):
for i in range(0,len(l)-1):
if l[i]<l[i+1]:
return False
return True
m = []
for i in range(0,len(l)):
b = is_rsorted(l[0:i]) and is_sorted(l[i:])
m.append(b)

if True in m:
print(‘true’)
else:
print(‘false’)

#Here is the code

Hey @sanchit123manchanda, everything is fine, just a little change, elements also must not be same,

n = int(input())
l = []
for i in range(n):
    a = int(input())
    l.append(a)

def is_sorted(l):
    for i in range(0,len(l)-1):
        if l[i]>=l[i+1]:
            return False
    return True

def is_rsorted(l):
    for i in range(0,len(l)-1):
        if l[i]<=l[i+1]: 
            return False
    return True

m = []
for i in range(0,len(l)):
    b = is_rsorted(l[0:i]) and is_sorted(l[i:])
    m.append(b)

if True in m:
    print(‘true’)
else:
    print(‘false’)

#Here is the code

Hope this resolved your doubt.
Plz mark the doubt as resolved in my doubts section. :blush: