diff options
| -rw-r--r-- | challenge-011/paulo-custodio/Makefile | 2 | ||||
| -rw-r--r-- | challenge-011/paulo-custodio/python/ch-1.py | 2 | ||||
| -rw-r--r-- | challenge-011/paulo-custodio/python/ch-2.py | 29 | ||||
| -rw-r--r-- | challenge-011/paulo-custodio/test.pl | 4 |
4 files changed, 32 insertions, 5 deletions
diff --git a/challenge-011/paulo-custodio/Makefile b/challenge-011/paulo-custodio/Makefile new file mode 100644 index 0000000000..c3c762d746 --- /dev/null +++ b/challenge-011/paulo-custodio/Makefile @@ -0,0 +1,2 @@ +all: + perl ../../challenge-001/paulo-custodio/test.pl diff --git a/challenge-011/paulo-custodio/python/ch-1.py b/challenge-011/paulo-custodio/python/ch-1.py index d8f93b7668..766c48fbba 100644 --- a/challenge-011/paulo-custodio/python/ch-1.py +++ b/challenge-011/paulo-custodio/python/ch-1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python3 # Challenge 011 # diff --git a/challenge-011/paulo-custodio/python/ch-2.py b/challenge-011/paulo-custodio/python/ch-2.py new file mode 100644 index 0000000000..7402779a99 --- /dev/null +++ b/challenge-011/paulo-custodio/python/ch-2.py @@ -0,0 +1,29 @@ +#!/usr/bin/python3 + +# Challenge 011 +# +# Challenge #2 +# Write a script to create an Indentity Matrix for the given size. For example, +# if the size is 4, then create Identity Matrix 4x4. For more information about +# Indentity Matrix, please read the wiki page. + +import sys + +def id_matrix(size): + id = [[0 for y in range(size)] for x in range(size)] + for i in range(size): + id[i][i] = 1 + return id + +def print_matrix(m): + output = "[" + sep = "" + for row in m: + output += sep+"["+", ".join([str(x) for x in row])+"]" + sep = ",\n " + output += "]" + print(output) + +size = int(sys.argv[1]) +id = id_matrix(size) +print_matrix(id) diff --git a/challenge-011/paulo-custodio/test.pl b/challenge-011/paulo-custodio/test.pl deleted file mode 100644 index ba6c37260b..0000000000 --- a/challenge-011/paulo-custodio/test.pl +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env perl -use Modern::Perl; -use Test::More; -require '../../challenge-001/paulo-custodio/test.pl'; |
