diff options
Diffstat (limited to 'challenge-179')
| -rw-r--r-- | challenge-179/paulo-custodio/perl/ch-1.pl | 2 | ||||
| -rw-r--r-- | challenge-179/paulo-custodio/perl/ch-2.pl | 2 | ||||
| -rw-r--r-- | challenge-179/paulo-custodio/python/ch-1.py | 21 | ||||
| -rw-r--r-- | challenge-179/paulo-custodio/python/ch-2.py | 20 |
4 files changed, 43 insertions, 2 deletions
diff --git a/challenge-179/paulo-custodio/perl/ch-1.pl b/challenge-179/paulo-custodio/perl/ch-1.pl index b6e72af146..2c84633b14 100644 --- a/challenge-179/paulo-custodio/perl/ch-1.pl +++ b/challenge-179/paulo-custodio/perl/ch-1.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Challenge 179 # diff --git a/challenge-179/paulo-custodio/perl/ch-2.pl b/challenge-179/paulo-custodio/perl/ch-2.pl index ee0470609e..9574baf26f 100644 --- a/challenge-179/paulo-custodio/perl/ch-2.pl +++ b/challenge-179/paulo-custodio/perl/ch-2.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Challenge 179 # diff --git a/challenge-179/paulo-custodio/python/ch-1.py b/challenge-179/paulo-custodio/python/ch-1.py new file mode 100644 index 0000000000..c00ee3dc90 --- /dev/null +++ b/challenge-179/paulo-custodio/python/ch-1.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 + +# Challenge 179 +# +# Task 1: Ordinal Number Spelling +# Submitted by: Mohammad S Anwar +# +# You are given a positive number, $n. +# +# Write a script to spell the ordinal number. +# +# For example, +# +# 11 => eleventh +# 62 => sixty-second +# 99 => ninety-ninth + +from num2words import num2words +import sys + +print(num2words(int(sys.argv[1]), to='ordinal')) diff --git a/challenge-179/paulo-custodio/python/ch-2.py b/challenge-179/paulo-custodio/python/ch-2.py new file mode 100644 index 0000000000..02019cb832 --- /dev/null +++ b/challenge-179/paulo-custodio/python/ch-2.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +# Challenge 179 +# +# Task 2: Unicode Sparkline +# Submitted by: Mohammad S Anwar +# +# You are given a list of positive numbers, @n. +# +# Write a script to print sparkline in Unicode for the given list of numbers. + +import sys + +bars = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"] + +nums = list(map(int, sys.argv[1:])) +max_num = max(nums) +height = [int((num / max_num) * 7) for num in nums] +chars = [bars[h] for h in height] +print(''.join(chars)) |
