SciPy দিয়ে দুটি ভ্যালুর পারমিউটেশন ও কম্বিনেশন বের করা যায়।
পারমিউটেশন: scipy.special.perm(N, k)
from scipy.special import perm
my_permute = perm(6, 2, exact=True)
print("The permutation of 6 and 2 is:")
print(my_permute)
আউটপুট
The permutation of 6 and 2 is 30
ব্যাখ্যা
- লাইব্রেরি ইমপোর্ট করা হয়েছে।
permফাংশনে প্যারামিটার পাস করা হয়েছে।- ফলাফল ভ্যারিয়েবলে অ্যাসাইন করে প্রিন্ট করা হয়েছে।
কম্বিনেশন: scipy.special.comb(N, k)
from scipy.special import comb
my_comb = comb(6, 2, exact=True)
print("The combination of 6 and 2 is:")
print(my_comb)
আউটপুট
The combination of 6 and 2 is 15
ব্যাখ্যা
- লাইব্রেরি ইমপোর্ট করা হয়েছে।
combফাংশনে প্যারামিটার পাস করা হয়েছে।- ফলাফল ভ্যারিয়েবলে অ্যাসাইন করে প্রিন্ট করা হয়েছে।