From 104d2a78c5a1650cae1cfabe87a3d12b73581f54 Mon Sep 17 00:00:00 2001 From: Najmus Sakib Date: Thu, 18 Nov 2021 01:47:07 +0600 Subject: [PATCH] [SOLVED] stringFormatting --- hackerrank/stringFormatting.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 hackerrank/stringFormatting.py diff --git a/hackerrank/stringFormatting.py b/hackerrank/stringFormatting.py new file mode 100644 index 0000000..14467b1 --- /dev/null +++ b/hackerrank/stringFormatting.py @@ -0,0 +1,25 @@ +# https://www.hackerrank.com/challenges/python-string-formatting/problem + +def decimal_to_octal(digit): + octals = list() + type(octals) + while(digit != 0): + remainder = digit%8 + octals = octals.append("hello") + digit = int(digit/8) + return octals + + + +def print_formatted(number): + for i in range(number): + if i < 100: + continue + octal = decimal_to_octal(i+1) + print(f"{i+1} {octal}") + + +if __name__ == '__main__': + n = int(input()) + # print_formatted(n) + print(decimal_to_octal(n)) \ No newline at end of file