From 3f3955e416d99b640c191c446d3c36acdd1509be Mon Sep 17 00:00:00 2001 From: Paulo Custodio Date: Fri, 15 Oct 2021 16:48:05 +0100 Subject: Add Perl and Python solutions to challenge 134 --- challenge-134/paulo-custodio/python/ch-2.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 challenge-134/paulo-custodio/python/ch-2.py (limited to 'challenge-134/paulo-custodio/python/ch-2.py') diff --git a/challenge-134/paulo-custodio/python/ch-2.py b/challenge-134/paulo-custodio/python/ch-2.py new file mode 100644 index 0000000000..d378a11ca2 --- /dev/null +++ b/challenge-134/paulo-custodio/python/ch-2.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +# TASK #2 > Distinct Terms Count +# Submitted by: Mohammad S Anwar +# You are given 2 positive numbers, $m and $n. +# +# Write a script to generate multiplication table and display count of distinct +# terms. + +import sys + +m, n = int(sys.argv[1]), int(sys.argv[2]) +terms = set() +for a in range(1, m+1): + for b in range(1, n+1): + prod = a * b + terms.add(prod) +print(len(terms)) -- cgit