![e+pi](https://d17mnqrx9pmt3e.cloudfront.net/media/logos/task/middle/e-pi-unsolved.png)
e+pi
![](https://d17mnqrx9pmt3e.cloudfront.net/media/missions/media/b7ab03d93c5f4fd18118696e6f7b7a6c/convert/grey/title.png)
In this challenge, you will be given a result, and your task is to find an arithmetic expression that uses only the numbers pi and e to yield that result. You can use addition, subtraction, multiplication, division, and exponentiation operations, and each number (pi and e) can appear at most two times. Parentheses are not allowed. If there are multiple solutions, return the one that requires fewer operations. If there are still multiple solutions, return the one that comes first alphabetically (without spaces). The calculated result must be equal with an error smaller than 1 x 10-10. If there is no solution for the input, return None. Non negative/positive symbol at the beginning is allowed.
Input: Floating point number (float).
Output: String (str).
Examples:
assert checkio(5.85987448205) == "e+pi" assert checkio(18.2958548951) == "e**e+pi" assert checkio(47.6085189284) == "e**e*pi" assert checkio(-0.42331082513) == "e-pi"
How it is used: In challenges that require finding arithmetic expressions, we can intuit interesting mathematical relationships. For example, one such relationship is the fact that 1/12 + 1/22 + 1/32 + ... = 1.64493406685... = π2/6.
CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.
In order to install CheckiO client you'll need installed Python (version at least 3.8)
Install CheckiO Client first:
pip3 install checkio_client
Configure your tool
checkio --domain=py config --key=
Sync solutions into your local folder
checkio sync
(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)
checkio serv -d
Alternatevly, you can install Chrome extension or FF addon
checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium
Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.
Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!
You are trying to join a pair programming session that has not started yet.
Please wait for the session creator to join.
It looks like the creator of the pair programming session closed the editor window.
It might happen accidentally, so that you can wait for reconnection.