Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Python3: List Functions I
#python 3.5.2 def emptyList(): return [] def initList(size,num): z=[] for i in range(size): z.append(num) return z def zeroList(size): z=[] for i in range(size): z.append(0) return z def lastList(alist): return alist[len(alist)-1] def findList(alist,amember): retval=False for i in range(len(alist)): if alist[i]==amember: retval=True return retval a1=emptyList() print(a1) a2=zeroList(5) print(a2) a3=initList(10,232) print(a3) a4=lastList([11,232,456,786,"hello"]) print(a4) a5=findList([11,22,"happy","hello"],"happy") print(a5)
run
|
edit
|
history
|
help
0
innerclass.py
handwash
Loop
Skillenza Common subjects
Repeated match within another regular expression
Helloworld
Achinta
Python
Alphabet
Python3: Class I : Person (ClassMethod)