Programming Polyglot

Published by Matt in

Create a function that takes a number that represents a person's programming language score, and returns an alphabetised array of programming languages they are proficient in. Arbitrarily assigned points for each language are listed below:

LanguagePoints
C#1
C++2
Java4
JavaScript8
PHP16
Python32
Ruby64
Swift128

Examples

get_languages(25) ➞ ["C#", "JavaScript", "PHP"]

get_languages(100) ➞ ["Java", "Python", "Ruby"]

get_languages(53) ➞ ["C#", "Java", "PHP", "Python"]

Notes

Easier using bitwise operations.

Watch a quick demo on how Edabit works.