Permutation, N People Can have R Seats In A Class

    0

    1

    CrypticSai-08

    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)
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.