I'm new to python and i can't figure out how to write a reverse for loop in python.
e.g. the python equivalent to the C lang loop
for (i = 10; i >= 0; --i) {
printf ("%d\n", i);
}
I'm new to python and i can't figure out how to write a reverse for loop in python.
e.g. the python equivalent to the C lang loop
for (i = 10; i >= 0; --i) {
printf ("%d\n", i);
}
You can use python range method.
for loop in python equavalent to C will be:
for i in range(10, -1, -1):
print i