
To Order:
Scroll down to view a full listing of KwicKode’s commands.
Click here to begin the 3-part tutorial, ‘Elements of KwicKode’.
Dan initially created KwicKode to be used in introductory programming courses to familiarize students with coding before jumping off into Python. However, when finished, he was amazed to realize that KwicKode was a fully functional laguage in its own right! But because of its simplicity and the fact that its commands are simple English sentences, even non-programmers can read the code like a storybook and know what is going on. For example, here is a four-line KwicKode program that illustrates four of the sixteen commands. If you understand this program, you are 25% on your way already!
Comment: Simple example of KwicKode commands.
Display “Please enter your first name…”.
Get string for my_name.
Display “Glad to meet you, “, my_name, “!”.
The KwicKode compiler (translator), which is included with the text, converts your KwicKode text files into Python for execution. Because KwicKode is built over Python, learning KwicKode is an excellent first step toward learning Python. The transition to learning Python is easy and straightforward. In addition, many of Python’s functions can be incorporated into a KwicKode program using KwicKode’s assignment or display commands.
Table of Contents
Introduction……………………………………………………………..1
Chapter 1 Output and Comments……………………… 4
Chapter 2 Variables and Assignments……………….15
Chapter 3 Prompts and Input……………………………. 22
Chapter 4 Blocks; Conditional Commands……… 27
Chapter 5 Functions……………………………………………. 33
Chapter 6 Loops…………………………………………………… 44
Chapter 7 Lists………………………………………………………. 51
Chapter 8 Basics of Program Design………………… 66
Chapter 9 File I/O…………………………………………………. 86
Chapter 10 Linked Lists and Databases……………. 94
Chapter 11 Generalizing Functions…………………. 102
Chapter 12 Database as a List of Records……… 110
Chapter 13 Sorting Records…………………………….. 135
Chapter 14 Springboard to Python…………………. 141
Appendix A KwicKode Commands…………………. 150
Appendix B Rules for KwicKode Syntax…………. 154
Appendix C kk_to_py_translator.py Listing…….. 157
About the Author……………………………………………….. 176
KwicKode’s 16 Commands and Variations
- Comment: … .
Ellipses may be anything. Ignored by computer. Required as first program line. - Display abc.
‘abc’ may be several comma separated items. - Display abc as list.
Items will be displayed in a vertical column. - Assign abc to xyz.
‘abc’ is a string or numeric value, math calculation, or Python function. ‘xyz’ is a variable. - Assign abc to list xyz.
Use this variation if ‘abc’ is a comma separated list of items. - Get string for xyz.
‘xyz’ will always be a string variable (text). Must be preceded with a ‘Display …’ prompt. - [If xxxx then:
‘xxxx’ is a conditional expression. - End of if block.]
- [Else:
Must always be preceded by an ‘[If…’ block. - End of else block.]
- [Function mno using (xxxx, yyyy, zzzz):
xxxx, etc. are values received from the function call (parameters). - Return xyz.
‘xyz’ is the value generated by the function to be returned to the call. - End of function block.]
- Call function mno with (xxxx, yyyy, zzzz) for xyz.
xxxx, etc. are the values sent to the function (arguments) for it to use.
xyz receives the returned value. - [Repeat block while xxxx with xyz:
‘xxxx’ is a conditional expression. xyz is the loop counter, starting with zero. - End of repeat block.]
- Create list mno.
Empties the list if ‘mno’ already exists. - Add xyz to list mno.
‘xyz’ may be a comma separated list of values or a single value. - Remove xyz from list mno.
First ‘xyz’ encountered is removed. - Create file mno.txt. or Create file mno.csv.
Empties the file if it already exists. - Copy data from xyz to mno.txt. or Copy data from xyz to mno.csv.
Output operations. Creates the specified file if it doesn’t already exist. - Copy database from xyz to mno.txt. or Copy database from xyz to mno.csv.
Output operations for list of lists. Creates the specified file if it doesn’t already exist. - Copy data from mno.txt to xyz. or Copy data from mno.csv to xyz.
Input Operations. Creates the specified list or variable if it doesn’t already exist. - Copy database from mno.txt to xyz. or Copy database from mno.csv to xyz.
Input Operations for list of lists. Creates the specified list or variable if it doesn’t already exist.