human
Write me a code to find last two digits of sum of N factorials and the other steps required given the following:
Find last two digits of sum of N factorials | Function to find the unit ' s ▁ and ▁ ten ' s place digit.
Let us write for cases when N is smaller than or equal to 10.
We know following ( 1 ! + 2 ! + 3 ! + 4 ! ... + 10 ! ) % 100 = 13 ( N >= 10 ).
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to find last two digits of sum of N factorials and the other steps required.
 def get_last_two_digit ( N ) :
	if N <= 10 :
		ans = 0
		fac = 1
		for i in range ( 1 , N + 1 ) :
			fac = fac * i
			ans += fac
		ans = ans % 100
		return ans
	else :
		return 13
N = 1
for N in range ( 1 , 11 ) :
	print ( " For ▁ N ▁ = ▁ " , N , " : ▁ " , get_last_two_digit ( N ) , sep = ' ▁ ' )