Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. def array10 (array):
  2. if (len(array) == 1):
  3. return False
  4. if (array[0]*10 == array[1]):
  5. return True
  6. return (array10(array[1:]))
  7.  
  8. def allStar(line):
  9. if (len(line) == 1):
  10. return (line)
  11. x = line[0]
  12. return (x + '*'+allStar(line[1:]))
  13.  
  14. def changePi(line):
  15. if (len(line) < 2):
  16. return line
  17.  
  18. x = line[0]
  19. y = line[1]
  20.  
  21. if (x == 'p' and y == 'i'):
  22. return ('3.14'+changePi(line[2:]))
  23.  
  24. return (x+changePi(line[1:]))
  25.  
  26. def harmonicsum (x):
  27. if (x<1):
  28. return None
  29. if (x == 1):
  30. return 1
  31. return (1/x + harmonicsum(x-1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement