eightmoons

Untitled

Apr 3rd, 2020
66
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×