human
Nth term of a Custom Fibonacci series | Function to return the nth term of the required sequence.
Driver code"
How can the above be solved in Python?
 Can you provide a code to nth term of a Custom Fibonacci series and the other steps required?
assistant
#Here is code to nth term of a Custom Fibonacci series and the other steps required.
 def nth_term ( a , b , n ) :
	z = 0
	if ( n % 6 == 1 ) :
		z = a
	elif ( n % 6 == 2 ) :
		z = b
	elif ( n % 6 == 3 ) :
		z = b - a
	elif ( n % 6 == 4 ) :
		z = - a
	elif ( n % 6 == 5 ) :
		z = - b
	if ( n % 6 == 0 ) :
		z = - ( b - a )
	return z
if __name__ == ' _ _ main _ _ ' :
	a = 10
	b = 17
	n = 3
	print ( nth_term ( a , b , n ) )