# When in doubt, go back to yourself.

--Originally published at Just A Turtle Coding.

So recursion is a useful resource in Python. It will save you lots of lines of code, bytes of memory and lots of time. Here’s how you do it:

To use this technique, you just have to include the same function you’re defining in the same function. An example is represented here:

The factorial function is recurring by definition but here’s an example of what or how it’s done. For more info, check out this post:

# When in doubt, go back to yourself.

--Originally published at Just A Turtle Coding.

So recursion is a useful resource in Python. It will save you lots of lines of code, bytes of memory and lots of time. Here’s how you do it:

To use this technique, you just have to include the same function you’re defining in the same function. An example is represented here:

The factorial function is recurring by definition but here’s an example of what or how it’s done. For more info, check out this post:

# Factorials again!

--Originally published at Just A Turtle Coding.

So here’s another use of the for loop, you can use it to calculate the factorial of a number.

First you have to declare your variable which will be storing the count, and the one which will be storing the total. After that you just multiply and add inside the for loop.

Another example done by turtle :D

# Factorials again!

--Originally published at Just A Turtle Coding.

So here’s another use of the for loop, you can use it to calculate the factorial of a number.

First you have to declare your variable which will be storing the count, and the one which will be storing the total. After that you just multiply and add inside the for loop.

Another example done by turtle :D

# Multiplying Stuff

--Originally published at Just A Turtle Coding.

A quick tutorial on how to make the factorial function using a while loop.

First you have to state a counting variable for it to go through the while loop, you also have to declare a variable where the total will be stored.

Then it’s just a piece of cake, you have to multiply the variable where the total is being stored. Important note, the variable with the total can’t be 0, it has to start at 1 for it to be multipliable.

# Multiplying Stuff

--Originally published at Just A Turtle Coding.

A quick tutorial on how to make the factorial function using a while loop.

First you have to state a counting variable for it to go through the while loop, you also have to declare a variable where the total will be stored.

Then it’s just a piece of cake, you have to multiply the variable where the total is being stored. Important note, the variable with the total can’t be 0, it has to start at 1 for it to be multipliable.

# Using Elif

--Originally published at Just A Turtle Coding.

Owner taught something about ifs and elses but what’s the difference between an else and an elif?

It’s easy, an elif statement has no limit as to how many of them you can put without indenting them.

For example, the elif compares something when the condition wasn’t met but there’s another condition to check.

This is only a simple post but I hope it clarified some doubts.

# Using Elif

--Originally published at Just A Turtle Coding.

Owner taught something about ifs and elses but what’s the difference between an else and an elif?

It’s easy, an elif statement has no limit as to how many of them you can put without indenting them.

For example, the elif compares something when the condition wasn’t met but there’s another condition to check.

This is only a simple post but I hope it clarified some doubts.

# L-oopsie

--Originally published at Just A Turtle Coding.

In Python, you have 2 types of loops. Both have different uses, Some you use when you know what and how many times you want it, other you use them when you’re like me, you don’t know how many times you’ll want it.

• For Loops: you use these types of loops when you know what you wanna do and how many times you wanna do it. When you are planning your day, you know how many hours you’re supposed to work (maybe you work those hours, or maybe less hours but you know how many time you’d be supposed to work).
In this example, you have a set and you wanna know how many of them are pairs. You use a for loop since you wanna only use that set.

And the result:

• While loops are a little bit different. A while loop needs a boolean conditional to work. You wanna do something as long as a condition is achieved, while I’m alive I know I wanna make Owner happy so my while loop would be like:
Turtle = alive
while Turtle = alive:
print(”Turtle wants you to be happy”)

For loop:

While loop:

# L-oopsie

--Originally published at Just A Turtle Coding.

In Python, you have 2 types of loops. Both have different uses, Some you use when you know what and how many times you want it, other you use them when you’re like me, you don’t know how many times you’ll want it.

• For Loops: you use these types of loops when you know what you wanna do and how many times you wanna do it. When you are planning your day, you know how many hours you’re supposed to work (maybe you work those hours, or maybe less hours but you know how many time you’d be supposed to work).
In this example, you have a set and you wanna know how many of them are pairs. You use a for loop since you wanna only use that set.

And the result:

• While loops are a little bit different. A while loop needs a boolean conditional to work. You wanna do something as long as a condition is achieved, while I’m alive I know I wanna make Owner happy so my while loop would be like:
Turtle = alive
while Turtle = alive:
print(”Turtle wants you to be happy”)