Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Showing Indentetion Problem
#1
mylist = [1,2,4,2,1,1,3,1,4,4,5]
def array_check(list):
for item in list:
if item==1:
a=True
elif item==2:
b=True
elif item==3:
c=True
else:
#nothing to do.
if ((a==True) and (b==True) and (c==True)):
return True
else:
return False
result = array_check(mylist)
print(result)
Reply
#2
Like this?

mylist = [1,2,4,2,1,1,3,1,4,4,5]
def array_check(list):
    for item in list:
        if item==1:
			a=True
		elif item==2:
			b=True
		elif item==3:
			c=True
		else:
			#nothing to do
			pass
	if ((a==True) and (b==True) and (c==True)):
		return True
	else:
		return False
	
	
result = array_check(mylist)
print(result)
I am trying to help you, really, even if it doesn't always seem that way
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020