t=int(input("enter no of test cases"))
global mylist1,mylist2
for a in range(t):
n = int(input("number of cubes"))
while True:
list_inp = input("enter list").split()
if len(list_inp)== n:
break
print("no of list items is not equal to specified length.")
mylist=[int(x) for x in list_inp]
x = min(mylist)
y = mylist.index(x)
mylist1 = mylist[0:x]
mylist2 = mylist[x:]
if isascend(mylist2) and isdescend(mylist1):
print('yes')
else:
print('no')
def isdescend(mylist1):
previous = mylist1[0]
for number in mylist1:
if number > previous:
return False
previous = number
return True
def isascend(mylist2):
previous = mylist2[0]
for number in mylist2:
if number < previous:
return False
previous = number
return True
In the if block isascend and is descend are not defined showing "unresolved reference" but why?? Why the function cannot be called?Is there some kind of order followed for defining a function in python. how can i resolve this?? I'm new to programming &symbol table concept.