Education and Didactics

2012 Submissions

[8] viXra:2012.0208 [pdf] submitted on 2020-12-28 11:00:57

Python 3 Lambda

Authors: K. S. Ooi
Comments: 9 Pages.

Python coders are traditionally imperative. They may program in the paradigms of structured or object-oriented programming, but seldom in functional program. The resurgence of functional programming in the past decade or so has sent Python coders into tailspin. Lambda functions appear in countless of code, not as pure functional but as hybrid to the traditional imperative. Various resources about lambda function add even more confusion. This article address lambda in the context of Python, with minimum jargon but with a number of illustrative examples.
Category: Education and Didactics

[7] viXra:2012.0202 [pdf] submitted on 2020-12-28 11:07:12

Python Formatted Output: Old and New

Authors: K. S. Ooi
Comments: 5 Pages.

The new string formatter of Python 3 has more to offer than the old formatted output absorbed from C. The adjustment can be specified by either :> (move to right), :< (move to left), or :^ (move to center), which is quite intuitive. One can select character to pad spaces and no longer to have only whitespaces as padding characters. With or without precision specification, the new formatter is predictable and intuitive.
Category: Education and Didactics

[6] viXra:2012.0195 [pdf] submitted on 2020-12-27 11:11:55

Formatted Output: The Forgotten C Facility

Authors: K. S. Ooi
Comments: 7 Pages.

Even though input and output facilities are critical in programming, we usually do not spend too much time on them in programming courses. When we teach a programming course to beginners, there are other more pressing topics we must cover, and therefore we do not allocate too much time on input/output facilities, other than using them to perform simple tasks of taking input from keyboard and output the result on the screen. In this article, we focus on formatted output facilities of C. The signatures of format in formatted output of C using printf can still be found in Python.
Category: Education and Didactics

[5] viXra:2012.0193 [pdf] submitted on 2020-12-27 12:25:03

Python’s Hello World

Authors: K. S. Ooi
Comments: 4 Pages. Nil

Compared to C and Java, the Python’s Hello World is a one liner. If we look beyond the line, there is more than meets the eye. Among the possible cursory detour one can take are: object/type, string multiplication, built-in string functions, for statement, list comprehension, mumbo jumbo, and even Hy. We dare you to explore.
Category: Education and Didactics

[4] viXra:2012.0186 [pdf] submitted on 2020-12-26 12:10:53

Map vs Filter in Python 3

Authors: K. S. Ooi
Comments: 6 Pages.

Higher-order functions are essential tools for functional programmers, but majority of Python programmers are imperative. When the higher-order functions are used in imperative development, it usually has negative impact on readability of the code. With a small investment on understanding these higher-order functions, we may be able to alleviate some miscommunication between developers with different backgrounds in Python. In this article, two higher-order functions are examined: map and filter. Few examples are given in this article to illustrate their differences. Keywords: Python 3, higher-order functions, map, filter
Category: Education and Didactics

[3] viXra:2012.0185 [pdf] submitted on 2020-12-26 12:19:35

Indexing for Sequence and Collection in Python 3

Authors: K. S. Ooi
Comments: 4 Pages.

String slicing technique can be applied to only one kind of Python 3 iterables. In Python 3, there are two kinds of iterables, the sequence and the collection. The string slicing technique can only be applied to sequence, and can not be applied to collection. For example, keys of dictionary are keys that uniquely identifies their respective values. Any values other than the keys cannot be used as identifiers. The implementation of Python in this respect is therefore clean. Keywords: Python 3, iterables, slicing, sequence, collection
Category: Education and Didactics

[2] viXra:2012.0181 [pdf] submitted on 2020-12-25 13:20:37

Reduce () in Python 3

Authors: K. S. Ooi
Comments: 8 Pages.

Python, the most popular language at this moment, is the language of choice to write readable code. As coding instructors, it is our virtue to teach students to write code that is easy to read and understand. However, Python was older than Java. There are functional programming components that survive, and many students find them too cool to ignore. I address one such higher-order function, reduce(), in this article. Over-reduce() is the first issue I discuss. If we understand the problem well and do not shoehorn our problem into reduce(), there are alternatives readily available. In this article, I gives few examples that we should not reduce().
Category: Education and Didactics

[1] viXra:2012.0161 [pdf] submitted on 2020-12-23 11:22:48

Velocity and Acceleration Vectors on Second Order Curves

Authors: Viktor Strohm
Comments: 22 Pages.

The movement of a material point along curves of the second order is represented by the differential equation. The projections on the coordinate axes of the first and second derivatives are calculated. The direction of the velocity and acceleration vectors is determined.
Category: Education and Didactics