Python Popularity


Python, Java, C on the winner's podium.
If programming languages were an olympic event, the gold medal would go to Python. That's the determination from the 2021 IEEE Spectrum rankings, with Java winning Silver, and C winning Bronze.

Python is a versatile language, easy to read and use, with well supported libraries for specialized domains such as networking, embedded projects, machine learning, and scientific modeling. In Spectrum's words, "Python dominates as the de facto platform for new technologies."

IEEE pulls their data from various sources, including their own membership, along with popular sites such as Stack Overflow, GitHub, and CareerBuilder. Unlike other language surveys, IEEE's rankings are interactive. Apply the appropriate filters to identify trending languages in the mobile space, and you would see Swift coming in at #7, and Kotlin at #17.  I was hoping they'd do a little better, but it was still a strong showing.

As a way to demonstrate some of Python's code, think of a number. If it's odd, multiply by 3, then add 1. If it's even, divide by 2. Take the result and repeat. Regardless of your starting number, you will eventually end up with the number 1. Depending on your starting number, this won't be easy to do in your head, and here's where Python can help.


def even(n):
    return n/2

def odd(n):
    return 3*n+1

n = int(input("Enter a number: "))
peak = n
hailstones = 0

while n > 1:
    hailstones += 1
    if n % 2 == 0:
        n = even(n)
        n = odd(n)
    peak = max(peak, n)
    print (int(n))

print ("Hailstones = ", hailstones)
print ("Peak = ", int(peak))

If you type in this code, note that spacing matters with Python! 

While this feels like math-magic, it is known as the Collatz Conjecture. It's a conjecture because, so far, no one has been able to prove that problem will always result in 1. For a fascinating explanation, watch the video below from Veritasium


Popular posts from this blog

MR2 Check Engine

Bookshelf: UNIX A History and a Memoir

Bookshelf Classic: The C Programming Language