python syntax

how to write a(–n)+b(n–) in python plz help

i-- or i++ does not work in python.

You can do this → i+=1 or i-=1. Read this you will understand. :slight_smile:

In python we do for i in range(0,n,stepsize) instead of for(i=0;i<n;i++) like other languages. Here stepsize is 1 by default if you do not mention.

1 Like

a(n-1)+b(n-1)

n=n-2

This should give the same result!!

Also if u are trying out the problem that u had earlier posted…it is most probably calculating 2^n…u deleted the post before I could reply…:slight_smile:

where do i put n-=2 then

still shows segmentation fault