This week’s missions: Permutation Index and Reversed Permutation Index
Since Python 2 has almost run its course, we’ve been kinda curious to ask. What Python version you’ve used for your first ‘hello world’ application?
Test yourself and have fun with the new missions created by kurosawa4434:
The first mission is called the “Permutation Index” and here you need to calculate the permutation index of a given tuple of integers.
assert permutation_index((2, 0, 1)) == 5 assert permutation_index((2, 1, 3, 0, 4, 5)) == 271
The second is the “Reversed Permutation Index” where your task is to calculate one of the permutations.
assert tuple(reversed_permutation_index(3, 5)) == (2, 0, 1) assert tuple(reversed_permutation_index(6, 271)) == (2, 1, 3, 0, 4, 5)
Check out some interesting articles we’ve selected for you:
- It’s absolutely fascinating! AI Learns to be a Car using a Genetic Algorithm. You have to see this and even play around with the code!
- Arduino has made electronic application design much more accessible to all developers. Discover in this tutorial how to use Arduino with Python, particularly learn how to set up electronic circuits, set up the Firmata protocol on Arduino, write basic applications for Arduino in Python, control analog and digital inputs and outputs, integrate Arduino sensors and switches with higher-level apps, and trigger notifications on your PC and send emails using Arduino.
- It’s possible! Easy Concurrency in Python. Even though Python is considered a poor choice for concurrent programming, mostly because of the ‘Global Interpreter Lock’, you have to see this procedure that can be used to get going with concurrent programming in Python.
Welcome to CheckiO - games for coders where you can improve your codings skills.
The main idea behind these games is to give you the opportunity to learn by exchanging experience with the rest of the community. Every day we are trying to find interesting solutions for you to help you become a better coder.Join the Game