Advertisement
Guest User

lecture2hw1

a guest
Aug 31st, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. ##  Tim's lecture2, homework#1 (?? how do we change it in to a function that can take in any list??)
  2. print ('begins')
  3.  
  4. sum1 =0
  5. sum2 =0
  6. lis = [1 ,2, 3, 4, 5]
  7.  
  8. def function1(i):
  9.     for i in lis:
  10.         if i > min(lis) and i < max(lis):
  11.             newione = i * 2
  12.             sum1 = sum1 + newione
  13.         else:
  14.             newitwo = i
  15.             sum2 = sum2 + i
  16.     total = sum1 + sum2
  17.     return total
  18.     print 'total value of Tim feature list: ', total
  19. function(i)
  20. print 'done'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement