← Back to challenges

The Golden Ratio

PythonHardmathnumbersstrings

Instructions

The golden ratio is ubiquitous in math, science, art, and nature. This challenge is concerned with the number itself, which is 1.618033988 to 10 significant digits. Implement a function that calculates the golden ratio to 100 significant digits using only integers, strings and basic arithmetic operations: +, -, *, //

Examples

golden_ratio() ➞ 1.618033988+90 more decimal places

Notes

This function has no argument so naturally there is only one test case.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.