By studying fossil records, scientists recognized that many animal phyla started appearing into existence about 541 million years ago (Cambrian period). During this time, life on Earth probably went through rapid evolution as all the major animal groups suddenly appeared. Scientists called this period as “Cambrian explosion”.

Why did many species suddenly appear?

In 2003, Andrew Parker, a zoologist from Oxford, revealed his “Light Switch Theory” for the first time. Scientists discovered that around 541 million years ago, the first animal developed eyes. And imagine for a second that you were an animal, you opened your eyes. Life definitely started…

Today, I will describe a new sorting algorithm: Merge Sort, a divide-and-conquer algorithm invented by John von Neumann in 1945. The general idea of merge sort is: when you solve a problem, if you can split the problem into two halves, solve each of them, one at a time (which is most likely easier because the problem in each half gets smaller.) And most importantly, if we have the answer for both halves, there is a simple and easy way to MERGE these two results into the result of the big problem.

First, we notice that when we have 2…

Visual representation of Shell Sort

Hi guys! In this blog, I’m going to explain to you about the “Power” of Shell Sort. Enjoy!

As you guys know, Donald L. Shell “gave birth” to the Shell Sort algorithm. He made substantial improvements to the insertion sort algorithm. This modified version is now called Shell sort. The Shell Sort algorithm is an algorithm that compares elements separated by a distance that decreases on each pass. Shell sort has distinctly decreased running times in practical work.

Here’s a two-minute video to recap what I’ve said about shell sort in my last blog:

Hope that you’ve understood the…

Computer Science

Someone once asked me, “What is computer science and why is it so fascinating to study?” To answer that question, Computer Science is the study of algorithmic processes and computational machines. Computer Science is such an interesting and exciting field thanks to the things you can create thanks to the knowledge in this field.

Binary search algorithm

One of the many algorithms that makes computer science so fascinating is the binary search, which is a truly effective and convenient search algorithm that finds a target value within a sorted list or array (that allows constant-time access to an i-th element). Though, binary search…


Python is known for allowing you to write code that’s simple, easy to write, and almost as easy to read as plain English. One of Python’s most remarkable features is the list comprehension.

What is List Comprehension?

List comprehension is a way of making list but in a single, short line. Yet, many developers struggle to fully understand list comprehension in Python and use for loops in so many places. That can lead to code that’s less efficient and difficult to read. If you find yourself using a for loop along with .append() to create a list, the list comprehension is a good substitute.

Last time, I showed you how to iterate through one list. But sometimes, you will have to iterate through more than one list. For example, you have two lists. One has even numbers, and the other one has odd numbers. You want to find the sum of the first two numbers, the second two numbers, etc. In python, there is a built-in operator that can zip two lists together, the zip() function.

Here is the code(Input):

my_list = [1,3,5,7,9]
my_other_list = [2,4,6,8,10]
for item1, item2 in zip(my_list, my_other_list):
print(item1 + item2)



I ask myself…

So far, I have only used while loops to determine if a number is prime or not. For today, I am going to explain to you how you can use for loop to tell if a number is prime or not.

To understand the code below, you first need to understand what a for loop is. So, what exactly is a for loop? A for loop is a control flow statement for specifying iteration, or repetition, in computer science, which allows code to be performed repeatedly.

So, this is how I did it:

x = 9
is_prime = True
the_primes = [2…

In my last blog, I showed you the slower version of how to tell if a number is prime or not. Last time, I promised you that I’d show you the faster version in my next blog.

So, here it is:

x = 17
i = 0
length = len(the_primes)
the_primes = [2,3,5,7,11,13]
is_prime = True
while i < length:
if x % the_primes[i] == 0:
is_prime = False
i = i + 1
if is_prime == True:
print((f'{x} is a prime number!'))
print((f'{x} is not a prime number'))

Input: x = 17

Output: 17 is a prime number!

I found out that you really don’t have to divide it by all the numbers before the number. You only have to divide it by the prime numbers before it.

A prime number is a number greater than 1 that is not a product of two smaller natural numbers. For example, 3 is prime because the only ways of writing it as a product, 1 × 3 or 3 × 1, involve 3 itself. But 6 isn’t a prime number because 6 can be written as a product, 2 × 3. My task is to use while loops in python to find if a number is prime or not.

For a given number I started checking if is divisible only by 1 and itself.

Here is my first solution:



Hi! I'm an elementary school student.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store