SimeonTs

SUPyF2 Functions-Exercise - 09. Factorial Division

Oct 8th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. """
  2. Functions - Exercise
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1728#8
  4.  
  5. SUPyF2 Functions-Exercise - 09. Factorial Division (not included in final score)
  6.  
  7. Problem:
  8. Write a function that receives two integer numbers.
  9. Calculate factorial of each number.
  10. Divide the first result by the second and print the division formatted to the second decimal point.
  11. Examples
  12. Input   Output      Input   Output
  13. 5       60.00       6       360.00
  14. 2                   2
  15.  
  16.  
  17. Hints
  18. • Read more about factorial here: https://en.wikipedia.org/wiki/Factorial
  19.  
  20. """
  21.  
  22.  
  23. def get_factorial(num):
  24.     factorial = 1
  25.     for i in range(1, num + 1):
  26.         factorial = factorial * i
  27.     return factorial
  28.  
  29.  
  30. def factorial_division(num_1, num_2):
  31.     return print(f"{(get_factorial(num_1) / get_factorial(num_2)):.2f}")
  32.  
  33.  
  34. factorial_division(int(input()), int(input()))
Add Comment
Please, Sign In to add comment