human
Last digit of sum of numbers in the given range in the Fibonacci series | Calculate the sum of the first N Fibonacci numbers using Pisano period.
The first two Fibonacci numbers.
Base case.
Pisano Period for % 10 is 60.
Checking the remainder.
The loop will range from 2 to two terms after the remainder.
Driver code"
How can the above be solved in Python?
 ... Write me a code to last digit of sum of numbers in the given range in the Fibonacci series and the other steps required?
assistant
#Here is code to last digit of sum of numbers in the given range in the Fibonacci series and the other steps required.
 def fib ( n ) :
	f0 = 0
	f1 = 1
	if ( n == 0 ) :
		return 0
	if ( n == 1 ) :
		return 1
	else :
		rem = n % 60
		if ( rem == 0 ) :
			return 0
		for i in range ( 2 , rem + 3 ) :
			f = ( f0 + f1 ) % 60
			f0 = f1
			f1 = f
		s = f1 - 1
		return ( s )
if __name__ == ' _ _ main _ _ ' :
	m = 10087887
	n = 2983097899
	final = fib ( n ) - fib ( m - 1 )
	print ( final % 10 )