def factorial(num):
          fact = 1
          for i in range(num, 1, -1):
              fact *= i
          return fact
      # user input
      n = int(input("Enter number of people: "))
      r = int(input("Enter number of seats: "))
      # finding all possible arrangements of n people on r seats
      # by using formula of permutation
      p = factorial(n) // factorial(n - r)
      # printing output
      print("Total possible arrangements:", p)
      
      Python language logo

      Permutation, N People Can have R Seats In A Class

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.