name = main

added if  __name__ == '__main__'
This commit is contained in:
gerroo 2018-10-28 13:36:39 -08:00
parent 9ded2c3d22
commit 261d721b22
2 changed files with 29 additions and 21 deletions

View File

@ -1,4 +1,5 @@
def n31(a):# a = initial number def main():
def n31(a):# a = initial number
c = 0 c = 0
l = [a] l = [a]
while a != 1: while a != 1:
@ -11,4 +12,7 @@ def n31(a):# a = initial number
print(a)#optional print print(a)#optional print
print("It took {0} steps.".format(c))#optional finish print("It took {0} steps.".format(c))#optional finish
return l , c return l , c
print(n31(43)) print(n31(43))
if __name__ == '__main__':
main()

View File

@ -1,8 +1,12 @@
def findMin(x): def main():
def findMin(x):
minNum = x[0] minNum = x[0]
for i in x: for i in x:
if minNum > i: if minNum > i:
minNum = i minNum = i
return minNum return minNum
print(findMin([0,1,2,3,4,5,-3,24,-56])) # = -56 print(findMin([0,1,2,3,4,5,-3,24,-56])) # = -56
if __name__ == '__main__':
main()