So are we encouraged to use match-case in recursion instead of if-else? It's more readable this way maybe:
cubocta310.py: def cubocta(n): """ https://oeis.org/A005902 """ match n: case 0: return 1 case _: return (10*n*n + 2) + cubocta(n - 1) print([cubocta(i) for i in range(10)]) (py310) Kirbys-MacBook-Pro:School_of_Tomorrow mac$ python cubocta310.py [1, 13, 55, 147, 309, 561, 923, 1415, 2057, 2869] https://flic.kr/p/2mKh2nd (image version) Kirby
_______________________________________________ Edu-sig mailing list -- edu-sig@python.org To unsubscribe send an email to edu-sig-le...@python.org https://mail.python.org/mailman3/lists/edu-sig.python.org/ Member address: arch...@mail-archive.com