Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197132

Add the numbers in a 9x9 multiplication Table

Path csiph.com!weretis.net!feeder9.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail
From HenHanna <HenHanna@dev.null>
Newsgroups rec.puzzles, comp.lang.lisp, comp.lang.python
Subject Add the numbers in a 9x9 multiplication Table
Date Thu, 2 Jan 2025 04:02:31 +0000
Organization novaBBS
Message-ID <0b09b939cdbbe465809a7ec27e30912a@www.novabbs.com> (permalink)
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
Injection-Info i2pn2.org; logging-data="1592508"; mail-complaints-to="usenet@i2pn2.org"; posting-account="4L8HabKtc1alsSAOmk7EUGDHKRhgGhC+6gJMfTsJB0A";
User-Agent Rocksolid Light
X-Rslight-Site $2y$10$VyJcZWv8vHmsbxYNJppC6eHAJdqi3CZZtBZQ0kopLrawiYGcs8Oo2
X-Face P#KeQ)CUdd!==@fw~Ms1=,Hb`IWtb6:Mw)x3B=H1BfNC\lz?Nb&)M9}$>?'X7l;CuB}utlJ=PHsRBSG6X>dYZ$[>P]$~+`>@V6$t}hTLoQ7XC~W\>:`B3ALU]SH;d(\MEc}znW8m}-ma&yPFkJ2@KSQrz=!Y;><;6a>z6N+mt`ClCt.PAE<o+B$qjwejZSZ,w]^;vrdl24z5(pm={l,F10qRDF
X-Rslight-Posting-User abae1fed5a82111a8790dc84735f550edb4392db
X-Spam-Checker-Version SpamAssassin 4.0.0
Xref csiph.com rec.puzzles:26393 comp.lang.lisp:60214 comp.lang.python:197132

Cross-posted to 3 groups.

Show key headers only | View raw


Pls give (show) me nice variations in Lisp and Python.  Thanks!!!



 A happy new year! ...

44 x 44 = 1936
45 x 45 = 2025   <--  one reason that  Puzzle nerds are excited today.
46 x 46 = 2116


_______________________________________
The following    (in Lisp (Scheme) and Python)    adds
                     all the numbers in a  9x9  multiplication Table.
________________________________
(print (apply +
          (apply append
             (map (lambda (y)
                        (map (lambda (x) (* x y))  (iota 9 1)))
                  (iota 9 1)))))
______________________________________
isum=0
for y in range(1, 10):
    print()
    for x in range(1, 10):
        print(f"{x*y:3}", end=" ")
        isum += x*y
print('  Total= ', isum, '\n')
_______________________________
kuku = [i*j for i in range(1, 10) for j in range(1, 10)]
print(sum(kuku))


_________

_________


i don't see why the Python compiler doesn't
           give me a STERN  warning when it sees that I have this line:
sum=0

Back to comp.lang.python | Previous | NextNext in thread | Find similar


Thread

Add  the numbers in a  9x9  multiplication Table HenHanna <HenHanna@dev.null> - 2025-01-02 04:02 +0000
  Re: Add  the numbers in a  9x9  multiplication Table Kaz Kylheku <643-408-1753@kylheku.com> - 2025-01-02 05:49 +0000
    Re: Add the numbers in a 9x9 multiplication Table "B. Pym" <Nobody447095@here-nor-there.org> - 2025-06-06 00:13 +0000
      Re: Add the numbers in a 9x9 multiplication Table "B. Pym" <Nobody447095@here-nor-there.org> - 2025-06-06 15:25 +0000
  Re: Add  the numbers in a  9x9  multiplication Table yeti <yeti@tilde.institute> - 2025-01-02 11:36 +0042
    Re: Add  the numbers in a  9x9  multiplication Table HenHanna <HenHanna@dev.null> - 2025-01-03 21:31 +0000
      Re: Add  the numbers in a  9x9  multiplication Table Kaz Kylheku <643-408-1753@kylheku.com> - 2025-01-03 23:12 +0000

csiph-web