Gamified Way to Drive Your Coding Skills
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.
Create program that prints
Hello World!when run from the command line or console locally.
[SheBang, Standard Output, Printing, Strings]
Create a program that prints
Hey thereby default or
Hey there Youif
Youis passed as an argument and
Hey there You over thereif
'You over there'is passed as the first argument (hint quotes).
[Variables, Parameters, Arguments, Formatted Printing]
Create a program named
Hi thereby default but prints
Hi <arg>if there is a command line argument. If a one of two special names (like
Rob) are passed then instead of the default the script should print something special like
Woah <arg>, you rock!If a specific insult name (like
Dork) is used the script should print
Um, no need to be rude.
[Algorithms, Condition Statements, Boolean Logic and Operators]
Write a command-line program that loops forever printing the word
[Looping, Signals, Interrupts,
Control-C, Printing to Same Line]
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]
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.
Create a program called
nowthat 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 called
hnowthat calls the first program and adds a default Markdown header prefix
hnowaccept one argument and use that instead of the default if set. Demonstrate using
viby combining it with
Create a program called
cmtthat 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. If
yesthen ask the next question. If
nothen print something snarky and end the program. If nothing is entered (or just empty spaces) then ask the same question again.