Advertisement
eightmoons

Untitled

Apr 3rd, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. def inputData():
  2.     x = int(input("Enter X: "))
  3.     y = int(input("Enter Y: "))
  4.     return {
  5.         "x": x,
  6.         "y": y,
  7.     }
  8.  
  9.  
  10. def compute(xy):
  11.     x = xy["x"]
  12.     y = xy["y"]
  13.     total = 1
  14.     for i in range(y):
  15.         total *= x
  16.     return total
  17.  
  18.  
  19. def myfactorial(n1):
  20.     result = 1
  21.     while n1 > 1:
  22.         result *= n1
  23.         n1 -= 1
  24.     return result
  25.  
  26.  
  27. def solveA(xy):
  28.     x = compute(xy)
  29.     n2 = myfactorial(xy["y"])
  30.     return round(x/n2, 4)
  31.  
  32.  
  33. if __name__ == "__main__":
  34.     xy = inputData()
  35.     a = solveA(xy)
  36.     print(a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement