Last active
October 14, 2024 11:47
-
-
Save staticaland/bee43dd29f2ea7317621573a52f74ccd to your computer and use it in GitHub Desktop.
This script generates a series of hash banners based on the golden ratio, making each line progressively shorter to fit within the aesthetic proportions of the golden ratio.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def golden_ratio_banner(depth, max_length): | |
| # Golden ratio value | |
| phi = (1 + 5**0.5) / 2 | |
| # Calculate and print each level based on the golden ratio | |
| for i in range(depth): | |
| length = round(max_length / (phi**i)) | |
| print("#" * length) | |
| if __name__ == "__main__": | |
| # Ask the user for the initial length (max length) with default value | |
| max_length_input = input("Enter the initial length (max length) [80]: ") | |
| max_length = int(max_length_input) if max_length_input else 80 | |
| # Ask the user how many levels deep they want with default value | |
| depth_input = input("Enter the number of levels deep you want [5]: ") | |
| depth = int(depth_input) if depth_input else 5 | |
| golden_ratio_banner(depth, max_length) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment