Look at the below code:
#include <iostream>
using namespace std;
int main() {
int n;
int i;
int k;
cout << "please insert n";
cin >> n; k=0 ;
for (i = n; i > 1; i--) {
cout << "/n "<< k << "+" << i << "=" << i + k++;
}
return 0;
}
I'm attempting to imitate the above code in python, however I don't know what I'm getting incorrectly. I don't know how to begin at a number, at that point decrement until the condition is met. This is what I have up until now:
k=0
n=4
for i in range(n)
if i > 1 :
i-=1
k+=1
print(i+k++)
Where I went wrong?