From 853618c8bba30d88e093fa3f31e5e40f363336ae Mon Sep 17 00:00:00 2001 From: newt Date: Wed, 9 Oct 2024 18:02:30 +0100 Subject: [PATCH] dailyprogrammer 391 --- python/dailyprogrammer/#391 - ABACABA.py | 14 ++++++++++++++ python/dailyprogrammer/readme.md | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 python/dailyprogrammer/#391 - ABACABA.py diff --git a/python/dailyprogrammer/#391 - ABACABA.py b/python/dailyprogrammer/#391 - ABACABA.py new file mode 100644 index 0000000..7d3f06a --- /dev/null +++ b/python/dailyprogrammer/#391 - ABACABA.py @@ -0,0 +1,14 @@ +from string import ascii_lowercase + +def abacaba(n): + output = '' + currLetter = 0 + for i in range(n): + output = '{0}{1}{2}'.format(output, ascii_lowercase[currLetter], output) + currLetter = currLetter + 1 + if currLetter > 25: + currLetter = 0 + return output + +out = abacaba(10) +print(out) diff --git a/python/dailyprogrammer/readme.md b/python/dailyprogrammer/readme.md index 13c79a7..7a7d6ed 100644 --- a/python/dailyprogrammer/readme.md +++ b/python/dailyprogrammer/readme.md @@ -5,6 +5,9 @@ [The Subreddit](https://reddit.com/r/dailyprogrammer) +- #391 - ABACABA + - [Solution](%23391%20-%20ABACABA.py) + - [Reddit Post](https://www.reddit.com/r/dailyprogrammer/comments/njxq95/20210524_challenge_391_easy_the_abacaba_sequence/) - #393 - Making Change - [Solution](%23393%20-%20Making%20Change.py) - [Reddit Post](https://www.reddit.com/r/dailyprogrammer/comments/nucsik/20210607_challenge_393_easy_making_change/)