heres one for the shoah foundation, i suppose

i didnt know mainstream publications still published things like this:

https://www.psychologytoday.com/blog/the-imprinted-brain/201608/autistics-undomesticated-humans

wow– no hyperbole intended; ive been to the holocaust museum, and i know there are fringe groups that circulate garbage like this, but how the hell was this published in 2016?

shame on you, “dr.” badcock. if i were your parents, id disown you before i even worried about what to do with the family name.

newb– a fun proglang being developed by arj

 

now someone is doing just that:

the blog entry: https://abdurrahmaanjanhangeer.wordpress.com/2017/02/27/newb-a-new-language-just-surfaced/

the github: https://github.com/Abdur-rahmaanJ/newB

and my first contribution, in case he can use it: (under any license he likes.)

license: creative commons cc0 1.0 (public domain) 
http://creativecommons.org/publicdomain/zero/1.0/ 
7c7,14
< with open('txt.nub','r+') as f: --- > filepath = 'txt.nub'
> from sys import argv
> if len(argv) > 1:
>     if len(argv[1]):
>         if ".nub" in argv[1]:
>             filepath = argv[1]
> 
> with open(filepath,'r+') as f:

 

since arj isnt using diff, im going to make these contributions simpler:

#### license: creative commons cc0 1.0 (public domain) 
#### http://creativecommons.org/publicdomain/zero/1.0/ 
from sys import argv
if len(argv) > 1:
    if len(argv[1]):
        if ".nub" in argv[1]:
            filepath = argv[1]

with open(filepath,'r+') as f:

 

 

whaling: beware of personalized account phishing

one of my favorite posts from annie manning– one more reason not to have every aspect of your life out on display online: (i thought this was called “spear-phishing,” but i suppose theres always a new way to dress up old terminology with small distinctions. either way, its a good thing for people to consider.)

 

A key reason whaling is so pervasive is that individuals overshare personal and behavioral data on the Internet. Phishers can tap this information otherwise known as OSINT. The well-crafted e-mails and web-pages are designed using the targets OSINT. The more personal information the target shares publicly, the greater the risk that this information will be used to manipulate them

via Phishing Evolved. — Cyber Essentials

understanding coding through other computer tasks

one of my goals as an “educator” is to always have an answer for someone who says this sort of thing– even while literally standing in front of a laptop, doing computer tasks (as they were today.)

  • “im not very ‘computery.'”
  • “im computer illiterate.”
  • “i dont really get computers, i just use them.”
  • “i would never learn/understand/get coding.”

 

i had a pretty nice conversation this morning where i explained that when you click on a menu, basically the computer is presenting you with options and youre selecting one by clicking on it– and that when you click, youre basically telling the computer to do a thing based on what item you select. ok, thats obvious.

then i said “coding is a lot like that, except instead of clicking an option, you basically tell the computer ‘do this thing.” for most people, the difference is “but its a lot more complicated than that!” but heres the thing– not always! and it doesnt have to be.

i tell people that in the 80s, it was easy for kids to learn to code. it wasnt part of the curriculum in every school, it was more of an extra-credit thing. but i took a computer class in high school. i didnt need it, but it was fun and exposed me to a few additional ideas– not to mention a class full of kids that were older (i was probably the only freshman, ta-da) and one guy was learning how to code in c. (i was impressed. i think he also gave me a boot sector virus, not necessarily on purpose… but i found it and removed it. no harm done.)

in the 90s, i tell people– it changed from teaching computers to teaching applications. this is a bit like taking swim lessons and only learning to dog-paddle because it works, and then switching people to a new sort of pool every 5-10 years so that they need to learn a new way to swim each time. and you can see the results everywhere– people that arent “computery,” using computers and often feeling helpless or at least frustrated.

im not saying everyone needs to be a computer enthusiast, but literacy is literacy, and “training” is training. and training results in literacy far less often. so when people say “everyone should learn to code,” they arent saying everyone should become a software engineer, or work for google. or get rich making video games.

touching quickly on actual coding, i wrote fig to make it easy to use and demonstrate these semi-universal programming concepts:

  • variables
  • input
  • output
  • basic math
  • loops
  • conditions
  • functions

 

i also wrote a little story in 6 parts called “the robot hypnotist” to explain them: https://codeinfig.wordpress.com/2016/02/12/the-robot-hypnotist/

many of these can also be explained using “everyday” computer tasks. many or all of these tasks could be familiar to you, some might not. lets see what we can accomplish:

 

  • variables

variables are an easy one. a variable is basically a piece of data with a name. when the program wants to keep track of something, it holds it in “memory.” two of the most important parts of the computer are the cpu– where the actual tasks are performed (its like the pencil in a ridiculously basic metaphor) and memory, (which is like the paper.) depending on how old your computer is, (say, 35 years old for example) your computer may save parts of memory to a floppy disk, or not at all. now it has a hard drive, or flash (which works more or less like a hard drive.)

a variable is just a piece of data with a name. in terms of the computer thinking the way a computer does, the computer:

  • puts the name itself in memory
  • puts the data its linked to in memory
  • puts a number representing WHERE in memory the data is, somewhere relative to where the name is stored.

so perhaps you create two variables called “name” which holds a persons name, and “mobile” which holds a phone number.

for each variable, the computer stores the words “name” and “mobile” in memory. when you ask for those variables, it looks up each– the name becomes a number, the number points to part of memory, and it goes to that part and gets the data that goes with the variable name.

so what everyday task is like setting a variable? creating a small file on your computer!

open your word processing program, type in a phone number, and save it as “phone.doc” or “phone.odt” or just type in “phone” and this is like creating a variable in programming/coding.

instead of being stored in memory, it will be stored first in memory (like most programs, the word processing program uses variables, it just doesnt tell you) and then it will be copied from the memory to a file on the hard drive. but its very similar.

variables are useful to coders because its usually easier to juggle a handful of names than a handful of numeric memory locations. heres a memory location:

b740:9a04

thats a short way (theres a story there) of saying: 3074464260. my question to you is, would you rather think about the numeric memory address 3074464260, or would you rather think about a variable called “name”?

so thats one of the main reasons that coders use variables.

theres another thing that works that way too: the internet domain name system. you type in wordpress.com, and your browser looks it up using an internet phone-book system thats called “dns.” just like the computer itself, the internet has a numeric address (called an ip number) for every resource currently attached to the internet. (thats pretty amazing.) so right this moment, if i type in wordpress.com into the web browser, it uses the numeric addresses i have in my dns settings to access the dns servers, which then take the query “wordpress.com” and give this number back:

192.0.78.9

 

thats where they have wordpress.com attached to the internet as i type this! but since wordpress.com is huge, it has many numeric entries. a smaller website could have the same ip address for months or even years, but running another dns query i get:

192.0.78.17

 

has wordpress.com already moved? no. because if  i go to the browser and give it the other ip: 192.0.78.9 it still takes me to wordpress.com (although the page it takes me to is https://en.wordpress.com/typo/?subdomain=192 which tells me: “The address 192.wordpress.com cannot be registered. Site name must be at least 4 characters. But you can sign up and choose another one.”)

but the number still points to wordpress.com! the day after i post this? its possible that all the numbers will be different. but a dns query for “wordpress.com” will stay updated (this is called “dns propagation,” but it just means “updating the addresses”) until automattic (the company that brings you wordpress) stops paying to re-register their domain– kind of like if you stopped paying to keep the same phone, eventually you would be removed from the phone book.

 

  • input

its difficult to come up with a metaphor for input that isnt itself input. when you let your computer go to a lock screen (or you suspend or lock the computer) you know it will come up with a place for you to type in your password. but when it asks you, thats a program that uses input to collect what you type in.

when you move the mouse, thats input. when you press keys, thats input. youre doing input all the time, but rarely do you ever do anything (other than lock the computer, or open a new file in an editor) that tells the computer “wait for input.” the computer is almost always waiting for input. when you dont have any other program specifically waiting for input, theres a program called the “shell” that is waiting for input. its the thing you type commands into, or the thing that lets you click icons on the desktop. whether its graphical or text-based, its the “shell” that allows you to tell the computer to run your software.

and you can write your own shell. you can even write a program that watches what files you open in your browser, so that you can make a “website” (just for your own computer, even if its not on the internet) to where you have pictures of say– your word processor. and if you click on that picture (or icon,) the program watching your web browser will open your word processor for you. that would be a shell.

having it in the web browser however, means that it might be possible for a clever person to create their own website on the internet, which if you went to it it might be able to say, open your word processor. they probably wouldnt be able to tell your word processor to do anything else, but you really dont want to give a website that much control. this is why even though i did create a “website” for my computer once, that let me open programs just by clicking on pictures or links, i never use that on a daily basis.

i have written other shells that are a better idea than that. in fact, there is now a polish version of a shell for dos and windows i wrote in 2006, which is still online and available for download. (im very flattered by this, even though its a very small program.) i used that shell for a very long time, instead of using the start menu in windows.

 

  • output

like input, so many things you tell the computer to do are output. the nature of a shell is input/output, which is another way to say “a shell is an interactive program.” it keeps taking input, and keeps giving output. you press a key, the letter or number or punctuation shows up on the screen (usually. a keyboard shortcut might not– something else will likely happen instead.) but if you open a document and print a file, this is output. if you play a video, or even just music, this is output. in coding, an output command can be as simple as print “hello world!”

in fig, you have to set a variable first, then the print statement will print whatever the variable is set to:

x ; “hello world” ; ucase ; print

 

that prints the contents of the variable x, which is holding the string “hello world”, which the ucase function made all-upper-case. but each command does something to or with the variable x:

  • x is the variable name
  • “hello world” puts exactly that text into x
  • ucase takes the text in x, makes it upper-case, then puts the new version in x
  • print takes the data stored in x and puts it on the screen
  • it works even without the semicolons: x “hello world” ucase print

 

i could also open a new file, name it x.doc, type “hello world” into the word processor, select all the text, and use a menu option to make it all uppercase. then i could open the file to put it on the screen. but whatever.

 

  • basic math

you could just open a calculator program. but the computer is constantly dealing with numbers– thats why its called “computer” (a fancy name for “calculator.” actually before computing machines, a “computer” was a person that did lots of tedious math on paper, and/or using a slide rule, etc. …this position is not entirely obsolete: an “accountant” is a bit like a “computer” that focuses on financial data, although they may use more modern tools and have to keep track of some fairly esoteric rules about the sorts of things they do.)

when you click on a window and move it, youre doing math. youre moving the arrow which is represented by a number of dots from the top of the screen– so by just moving the mouse up, youre subtracting from the “y” value of the picture of the arrow. (a touchscreen works based on a similar idea. it ultimately produces numeric data.) as it moves sideways, the “x” value changes.

 

  • loops

if you select a handful of icons and click “open” on all of them at once, you are basically telling the computer to “iterate” or “loop over” the items you have selected. in fig you can have a group of words in a string:

x “hello there, how are you?”

 

and split the the string into words, based on the fact that theres a space between them:

x ; “hello there, how are you?” ; split x ” “ #### now x is a group of 5 words– just go with it

 

then you can loop over each one, just like when the computer opens all the files (icons) you selected:

forin word x
now word print
next

that will put each “word” on the screen, one after the other:

hello
there,
how
are
you?

ive been doing this for 30 years, and i still think its a little freaky that a machine can process words that easily. (of course, it has no idea what they mean unless you tell it what they mean. and thats just more letters to the computer.)

i shouldve mentioned this in the “math” part, but the computer stores letters as numbers too. the letter “e” in hello for example: is the number 101. lots of things can be the number 101, but to store “e” as 101 you have to use a thing called “encoding” to translate things into numbers. two important encodings associate “e” with 101: ascii encoding, and unicode (which actually starts with ascii and keeps going. so the unicode for ascii 101 is unicode 101.)

ibm had an encoding scheme called “ebcdic” where “e” was 133. im a coder, and i dont usually keep track of these numbers. i know lowercase “a” is 96 (oops, no, its 97) but the way i find out is either looking it up on wikipedia (which i have no need of doing– except i dont have a quick command for ebcdic) or i use ord(“a”) in python or x “a” asc in fig. this gives me the number 97.

 

  • conditionals

the easiest way to demonstrate a conditional in everyday computing tasks is to setup something to run at a certain time– like scheduling a blog post.

scheduling can be thought of (and implemented as) a loop that says something like:

“is it wednesday, at or after 1:30:00 pm?”

“if no, do nothing.”

“if yes, do the thing that was scheduled for that time.”

and then keep looping until the answer is “yes.” then stop looping (or keep looping, if there are any other times scheduled. or just in case times are added.)

 

  • functions

a function is a name attached to some code. whoa! thats so simple, that people get confused by it.

if you attach data to a name, thats a called a “variable” and the variable is “referenced” when you use the variable later.

if you attach program code to a name, thats called a “function” (or if the function is attached to an object, its called an “object method” as objects have to make everything so very special…) and the function is “called” when you use the function later. this is just terminology– if youre “calling” a function, you are using it. if you “reference” a variable, you are using it.

how often do you call a function? well for example, every time you click on a menu– whether its the start menu or the little menu at the top of some programs (theyre getting more and more rare, but the “ribbon menu” counts too.) then each of these things you do ultimately call a function.

opening a program by clicking on an icon, is also like calling a function. in fact everything the computer does is generally arranged into “functions.” in the old days, function calls were known as “routines” or subroutines. there are ways to distinguish between these concepts, but the distinguishing characteristics are small.

you can call a function that doesnt return a value a  “sub” and otherwise you can call it a “function.” or you can do like i do, and use the word “function” for both. in fig, functions are created (“defined”) using the function command (this name comes from basic. it also exists in other languages.) in python, you define a function using the def command.

 

this is essentially what coding is!

 

 

functions in fig

this is part 7 of an introductory series on fig programming. for part 6, go here.

 

part 7: functions in fig

 

in the previous chapter, we put together some code that asks for (and insists upon) a number.

if youve ever been to a website that rejected some input because it wasnt suitable, the code that does that is very similar. (its likely written in javascript or php though, because those are still very common languages for websites.)

we have learned several fig commands, and there are several more to learn in this chapter– but for the moment we are going to learn how to make new ones. first here is the code from before:

while
    x "please enter a number: " prints lineinput
    try
        y x val
        break
        except
        now "" print "thats not a number." print
        resume
    wend
now y print # this is the number we know is numeric

 

see the now y print at the bottom? the variable y is the one we get when things go right. keep that in mind.

to create a function (a new fig command) called thisthing which uses one parameter: x and converts it to the cosine of x radians, do this:

function  thisthing x
    now  x  cos  return now
    fig

 

ok, but thats not what we are doing. we are going to create a function called asknumeric with zero parameters.

we define our function using a function block:

function asknumeric
    # we really need the pass command here.
    fig

 

and the code inside the block will produce a variable called y, so lets ask the function to return that value (as the functions own value)

function asknumeric
    # our code will go here
    now return y
    fig

 

lets put the two together:

function asknumeric

while
    x "please enter a number: "  prints  lineinput
    try
        y x  val
        break
        except
        now ""  print  "thats not a number." print 
        resume
    wend
now y print # this is the number we know is numeric

    now return y
    fig

 

we can get rid of the “now y print” line:

function asknumeric
while
    x "please enter a number: "  prints  lineinput
    try
        y x  val
        break
        except
        now ""  print  "thats not a number." print 
        resume
    wend
    now return y
    fig

 

okay, run the program…

what? it doesnt do anything. congrats! its your first custom-made fig command.

youve defined it using function but you havent used it yet!

your new function is called asknumeric and always returns a number, so you can use it like this:

x  asknumeric  times 1000  print

 

any time you want to use your asknumeric command, just use it like you would any other fig command. (it will only be available in programs that contain the definition before you use it.)

you can even create a user-defined function that calls another user-defined function:

function doitagain
    x  asknumeric  times 1000  print
    fig
now doitagain

 

lets run this and see what happens…

please enter a number: okay

thats not a number.
please enter a number: yes it is!

thats not a number.
please enter a number: a number

thats not a number.
please enter a number: 5.78
5780

 

one of the more interesting things about writing programs is coming up with names for the different variables (and functions.)

if you pick a name that is too short or not very descriptive– x for example, is really only “descriptive” if youre describing a point on a horizontal axis– then you cause anyone reading your code to suffer a little.

if you pick a name that_is_too_absurdly_long then you cause anyone re-using (referencing) that name to suffer. people dont seem to mind this as much (i do, so i tend not to use very long names.)

if youre writing a manual, it matters somewhat less because people know “x” is always a variable.

but coming up with names is “work” sometimes.

whats more, is coming up with names can get in the way of more pressing or important matters; anything that helps reduce the amount of “overhead” in terms of organizing used and unused variable names is an idea worth considering.

one handy thing about functions is “scope.” if you are defining a function, the name you use to call (reference, refer to) the function– its name– is a thing you have to put some thought into. you want to give it a name that explains what it does, and preferably will also be easy to think of later.

everything inside the function is more or less isolated. this isolation is called “scope,” and it can be viewed as an inconvenience or an enormous help.

if youre writing a large, complicated program, organizing everything into functions is the best thing you can do. (you can also use objects, which are more complicated, and then “functions” will be called “methods” as far as terminology goes. but fig doesnt really get into objects.)

because of this “scope” isolating the stuff inside the function block, you (usually) need a way to get information from the program into the function.

in our first example, information gets into the function by way of the lineinput command. but if you refer to a program variable thats outside of a function youve created, the function will not know anything about it.

put another way: a variable called “cheese” outside the function block is going to have a totally different value / significance / relevance as a variable with the same name inside the function.

this is great because when youre creating a function, you dont have to know what variables are used in the program that calls it. for all you know, “x” is the most important variable in the whole program– so if you need a variable named “x” in your function, its completely separate; the two dont interfere. every function can have its very own “x” variable with its own value.

and every function does get its own variables. but what if you want to get some information from the program into the function? this is done with parameters.

lets name a couple of parameters thing1 and thing2. (you can have 0 or more parameters, even 20 of them. however the smaller the number, the better.) parameters dont need numbers by the way: we are using numbers in the name purely for fun.

function inthehat thing1 thing2
    pass
    fig

 

is a valid definition. lets have it print the number of characters in each parameter:

function inthehat thing1 thing2
    q 34  chr
    now q  plus thing1  plus q  plus " has " prints
    now thing1  len  str plus " characters." print

    now q  plus thing2  plus q  plus " has " prints
    now thing2  len  str plus " characters." print
    fig

 

and lets call the function, with two strings:

now  inthehat "hello" "mike"

 

outputs this:

“hello” has 5 characters.
“mike” has 4 characters.

 

one of the fun things about this code is it adds ascii 34 (a computer code for a double quote) to the string, so the output can display the string in quotes. that would be a useful function, actually:

function quote qstring
q 34  chr
withquotes q  plus  qstring  plus q  print
fig
now "this will be printed in quotes"  quote now

 

it works perfectly, but all it does is build the quotes into the string and print it. wouldnt it be cool if like other built-in functions, it could change the value of the main variable?

well, thats what return is for. lets change one line:

function quote qstring
q 34  chr
withquotes q plus qstring plus q  return withquotes
fig

 

now we have a function we can use anywhere in our program– so long as its after the function definition. lets fix up our other function with it. it does the same as before, with cleaner lines:

function quote qstring
q 34  chr
withquotes q plus qstring plus q  return withquotes
fig

function inthehat thing1 thing2
    now  quote thing1  plus " has " prints
    now thing1  len  str plus " characters." print

    now  quote thing2  plus " has " prints
    now thing2  len  str plus " characters." print
    fig

 

and call it:

now  inthehat "hello" "mike"

 

“hello” has 5 characters.
“mike” has 4 characters.

 

and it works! our function uses the len function (built in) to figure out how many characters the strings have– len will also find the length of an array, but not a numeric. so if you do this:

now  inthehat "hello" 5

 

your function will not work. you can fix this by putting the line that has len in a try / except / resume conditional block, and deciding what to say if it trips the except section.

you can also reword the ” characters.” string so that it says something like “ characters (or array elements).” thats up to your preference, obviously.

hopefully from these examples you can practice writing and editing functions. they are very powerful: half the job of creating your own programming language could be writing functions. fig has more functions built-in, so lets see them:

x  y  lcase  # copy y to x and make all-lowercase


x  y  ucase  # copy y to x and make all-uppercase


x  y  str  # copy y to x and convert num to string 


x  "dir"  shell  # run commands in bash/sh or dos 


x  "hello"  asc  # convert first character in a string to 
                 # numeric ascii code


x  "50.537"  val # convert string number to numeric


x  "hello there"  len  # length of string or array


x  52  not  # return -1 for zero and 0 for non-zero


x  "  space from left"  ltrim # cut lefthand space


x  "space from right  " rtrim # cut righthand space


x  10  chr  # convert integer to ascii / unicode
x  "dir"  arrshell  # load an array with command line output


x  arreverse  # reverse the order of an array


x  y  reverse  # copy string y to x and reverse


x  arrsort  # sort an array


x "hello"  left 2  # get leftmost 2 characters


x "hello"  right 2  # get rightmost 2 characters
    

x  arrget rr 5  # set x to 5th item of array rr


rr arrset 5 "hello" # set 5th item in rr to "hello"


x  y  mid 5 1  # copy y to x, and set x to a range/section of 1 
               # character(s) or item(s) starting with the 
               # 5th. (works on strings and arrays.)


p  string 12 104  # string of 12 x  ascii 104


p  string 12 "h"  # string of 12 x  "h"


x  instr "hello" "e"   # finds the first instance of "e” in 
                       # "hello” and returns the position; which 
                       # in this case is 2 (0 if not found.)


x  "/"  chdir  # changes the folder the program is working in.


now  end  # quits the program (closes files too)


now  system  # exactly the same as end


now  swap x y  # switches the values of x and y


now  get parametername  # earlier versions of fig required this 
                        # to copy parameters inside functions; 
                        # it is no longer required, but can still 
                        # be used to copy variables into the main
                        # variable.


x  split "hello" "e"  # split string by "e" into array ['h', 'llo']


e  join x "a"  # join array using "a" in between items

 

splitting by “e” and joining by “a” will change all instances of “e” to “a” in a string. you can create a function called replace like this:

function replace changewhat chfrom chto
    p  split changewhat chfrom  join p chto 
    now  return p     
    fig

 

then you can call it this way:

phrase "hello there"  replace phrase "he" "a"

 

here are a couple more functions you can use; basic and python (therefore fig) use radians for angles in trig functions. perhaps you would like to use degrees:

(all the code in this book is in the public domain / has its copyright waived under cc0, so feel free to use these functions in your programs)

function degrees2radians dg
    pi 1  atn  times 4   
    rd dg  times pi  divby 180  return rd    
    fig
function radians2degrees rd
    pi 1  atn  times 4   
    dg rd  times 180  divby pi  return dg    
    fig

 

 

 

in case youve ever wanted to send a pm, here is one way

ive been running a forum for some time, without a lot of luck with it. a few people joined, one guy is still hanging around, the forum host recently lost the server that held the file attachments (oh dear) but theyre making a valiant effort to restore them.

the “unofficial” forum is the official home of:

  • fig (the programming language)
  • fig os (the derivative of refracta made with– and including– fig)
  • any distro that you author and would like to join to talk about

it is also a place where you can talk about various distros. if you meet izi hes a little acerbic, but a good guy and fellow python coder. i have no intention of abandoning the blog, but you can still feel free to join me at:

http://unofficialdistros.freeforums.org

 

 

our first class begins with a quiz (what?!)

this quiz is specifically designed for someone who is already out of college, didnt learn anything about code but shows enough interest to try out a class or tutoring session.

the important thing isnt so much what they answer, (you can even mention that) but the questions and choices are what matter.

its a warm-up to get them into the subject without feeling like they have to pay close attention, and hopefully the answers are all obvious enough that by trying to answer them, you teach yourself something.

a quick lecture would not serve as a warm-up, and would put more pressure on someone to pay attention. hence a quiz. plus you get to tell a person who is brand new to the subject: “ok, we start with a quiz!” then they think youre a sadist… and then you lay question 01 on them:

 

simple question 01: (of ten)

what do you think cls does?

a. puts text on the screen
b. reboots the computer
c. clears the screen of text
d. crashes the internet

 

if they get it wrong, you make sure they understand its not important right now (how could it be?) and tell them it clears the text. maybe they just learned a command, maybe not. next question! (definitely keep it moving…)

 

simple question 02:

which command do you think opens a new file to save data

a. arropen “text.txt”
b. open “r”
c. close
d. open “w”

 

simple question 03:

what do you think print does?

a. puts text on the screen
b. clears the screen
c. changes the color of something
d. adds two numbers

 

simple question 04:

why on earth would that be called print, anyway?

a. before computer screens were common, computers used teletypes
b. the basic command for putting text on the screen was called print
c. a few computer languages call it that, because of teletypes mentioned
d. all of the above

 

simple question 05:

which of these commands converts text to uppercase?

a. str
b. val
c. ucase
d. mid

 

simple question 06:

what do you think mid does?

a. quits the program
b. crops text from the middle of a character string
c. downloads music from youtube
d. converts text to lowercase

 

simple question 07:

which of these commands lets you print to the screen in yellow?

a. mid 5 20
b. arrcurl “time.org”
c. prints
d. colortext 14

 

simple question 08:

what does the divby command do?

a. adds two numbers
b. subtracts one number from the other
c. draws a line on the screen
d. divides one number by another

 

simple question 09:

what are the names of the other arithmetic commands?

a. plus, minus, times
b. add, subtract, pizza
c. gaga, ooh, lala
d. one, two, tres, cuatro

 

simple question 10:

how do most people learn how to write code?

a. standing on their head and listening to beatles 45s at 78 speed
b. typing in examples,attempting simple tasks and taking other code apart
c. “lasers”
d. somewhere along the way to their phd in rocket science

 

novice question 01: (of five)

what is the best description of programming?

a. writing instructions a computer can understand
b. writing instructions no mortal can comprehend
c. designing the coolest video game ever imagined
d. living in your parents basement (ok, yes– trick question!)

 

novice question 02:

what is a variable?

a. something only the computer knows, but wont tell you
b. a name that has data assigned to it
c. the thing that flips down on the front of a printer
d. an exciting dance routine that was banned in finland

 

novice question 03:

which of these is a valid line of fig code?

a. just do what i want!
b. hello computer, would you clear the screen?
c. x  “hello, world!”  colortext 2  print
d. when{you go out}– pick up{some eggs};

 

novice question 04:

most lines of fig code begin with a / an…

a. variable
b. octopus
c. equation
d. soundbite

 

novice question 05:

fig consists of more or less the following:

a. oranges, cherries, grapes, whipped cream
b. hypotenuse, circumference, primes, isosceles
c. functions, input/output, loops, conditions, variables
d. celtic runes and secret handshakes

 

advanced question 01: (of five)

which of these lets you count backwards from 15?

a. now  “hello”  print
b. for x, 15, 1, -1
c. forin x, textfile
d. count backwards from fifteen

 

advanced question 02:

which of the following fig syntax is *optional*:

a. quotes for strings
b. # hashes for comments
c. 5.5 decimal points in non-integers
d. ( ) | ; : ,

 

advanced question 03:

what is an array?

a. a file that lets you save your game
b. an input device
c. a type of variable that stores multiple items
d. another way of saying “internet”

 

advanced question 04:

which of these best describes a function?

a. text input from the keyboard
b. the numeric ascii value of a character
c. an operator applied to an array
d. a section of code that is given a unique name

 

advanced question 05:

what is a conditional?

a. i will tell you if you give me 5 dollars
b. that depends, what day of the week is it?
c. a section of code that runs if two items correspond in a specific way
d. all of the above

 

if 20 is too many questions, skip the “advanced” questions and get on with the lesson.

 

be sure that anyone taking the quiz understands the purpose is to warm up, not to get the answers right. if you dont want them to relax, start with functions– theyre the most difficult of the “7 concepts” in fig:

  • variables
  • input
  • output
  • basic math
  • loops
  • conditionals
  • functions