Language Learning Challenges
Gamified Way to Drive Your Coding Skills
These challenges are designed to be researched and coded in order to incrementally learn new concepts and skills for any language. The challenges require completing several combined tasks which you will need to research and learn for your target language. You can do them all in one language at a time or learn several languages at the same time. (Mr. Rob recommends Bash, Go, C, JavaScript/TypeScript, Python, Ruby, and Rust.)
Note that all of these challenges assume you will be doing them from a Linux command line so you will first need to become proficient with Bash and a terminal editor such as the recommended Vim. This is by design. If you can learn to edit, compile, and run code from the command line you can do it anywhere else, but the reverse is simply not true. Since most coding these days involves Linux and the command line you will be ahead of everyone else who doesn’t learn it that way. It’s a simple fact.
Remember to include the name of the language in your research about the given topics. Otherwise, your search results will often be much too broad.
Hello World
Create program that printsHello World!
when run from the command line or console locally.
[SheBang, Standard Output, Printing, Strings]Hey There
Create a program that printsHey there
by default orHey there You
ifYou
is passed as an argument andHey there You over there
if'You over there'
is passed as the first argument (hint quotes).
[Variables, Parameters, Arguments, Formatted Printing]Hi You
Create a program namedhi
that printsHi there
by default but printsHi <arg>
if there is a command line argument. If a one of two special names (likeLinux
andRob
) are passed then instead of the default the script should print something special likeWoah <arg>, you rock!
If a specific insult name (likeDork
) is used the script should printUm, no need to be rude.
[Algorithms, Condition Statements, Boolean Logic and Operators]Nyan Cat
Write a command-line program that loops forever printing the wordNyan
(or something).
[Looping, Signals, Interrupts,Control-C
, Printing to Same Line]RGB Command
Create a command that takes three arguments for red, green, and blue that are numbers between 0 and 255. Combine the numbers into a vt100 (ANSI) RGB color escape and print the escape sequence invisibly coloring anything printed after. Test by printing different things in different colors. Once that works go back and assign random default color values for each if less than three arguments are passed.
[VT100 ANSI Escape Characters, Terminal RGB Color Escapes, Variables, Quoting Backslash Escape Characters, Random Number Generation]Greetings
Create a command line program that when run greets the user and prompts them to enter their name. Then read the name and print a nice personalized greeting using it. If the name is not entered or contains only whitespace then print a message about not understanding and prompt again for a good name. Repeat the message and prompt forever until a good name is entered.Now
Create a program callednow
that prints a specific human-friendly time stamp suitable for including in an article or a blog (Monday, June 29, 2020, 8:28:26PM). Create another program calledhnow
that calls the first program and adds a default Markdown header prefix##
. Havehnow
accept one argument and use that instead of the default if set. Demonstrate usinghnow
fromvi
by combining it with!!
correctly.Comment Out
Create a program calledcmt
that reads in every line of input and adds a comment prefix to each line and outputs the newly prefixed line. Once that’s complete have the program check for arguments and use them as the prefix instead.Do You Like Waffles?
Write a command-line program that simulates the now ancient video Do You Like Waffles prompting the user with questions and checking their responses. Ifyes
then ask the next question. Ifno
then print something snarky and end the program. If nothing is entered (or just empty spaces) then ask the same question again.