Advertisement
Guest User

Untitled

a guest
May 23rd, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import math
  2. def multipliers(number):
  3. if number == 1:
  4. print(1)
  5. lst = []
  6. i = 2
  7. while number != 1:
  8. if number % i == 0:
  9. number = number // i
  10. lst.append(i)
  11. continue
  12. i+=1
  13. print(lst)
  14.  
  15.  
  16. def equation(a, b, c):
  17. d = b*b - 4*a*c
  18. if d >= 0:
  19. sd = math.sqrt(d)
  20. s = lambda k: format((-b+k*sd)/(2*a))
  21. l = ' and '.join(set(map(s, (-1,1))))
  22. print 'Otvet: %s' % l
  23.  
  24. def simple(number):
  25. for i in range(2, number - 1):
  26. if not number % i:
  27. return False
  28. else:
  29. return True
  30.  
  31. # atm uses only 100, 50, 20, 10, 5 and 1 notes.
  32. def atm(summ):
  33. a = summ % 100
  34. b = summ / 100
  35. a1 = a % 50
  36. c = a / 50
  37. a2 = a1 % 20
  38. d = a1 / 20
  39. a3 = a2 % 10
  40. e = a2 / 10
  41. a4 = a3 % 5
  42. f = a3 / 5
  43. a5 = a4 % 1
  44. g = a4 / 1
  45. print(b)
  46. print(c)
  47. print(d)
  48. print(e)
  49. print(f)
  50. print(g)
  51.  
  52.  
  53. print multipliers(30030)
  54.  
  55. print equation(2, 19, 35) # 2x^2 + 19x + 3
  56. # 5 = 0
  57.  
  58. print simple(13)
  59.  
  60. print atm(287)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement