24 Coding challenges
Make a string that puts all the letters of the alphabet backwards. So: zyx.....cba. created by the number code, not the letters. Do this with a loop. tip: think of ASCII.
You get a string with a complete address: Rijksweg 44, 6533 XT Amsterdam Assignment: filter the zip code from the string The postcode location can be anywhere in the string and complies with the Dutch postcode rules tip: find the right pattern.
You get an e-mail address from an input field. Check if this is really an email address.
Create a program that sorts an input string. The string contains letters and/or numbers mixed up.
The output is all letters in sequence and all numbers in sequence. Use the bubble sort technique.
eg: input="test" output="est" eg: input='3618' output='1368'
The entry is a phone number. Check whether this is a Dutch or Belgian telephone number AND whether it is a mobile number.
The $list array contains 5 addresses, each with the last name, phone number, and email address. The command is to convert this array with an indefinite number of lines into an HTML table.
Find what the Fibonacci sequence is and create an algorithm that prints it on the screen. Do this for 25 elements. You have to calculate them, not take them from a table.
Create an application that displays all prime numbers < 100 on the screen. You have to calculate them, not take them from a table.
a = 10, b = 20
Create a routine that swaps these 2. Use a maximum of 2 variables. So don't use a helper variable!
Result is:
$a = 10;
$b = 20:
echo $a .
echo $b;
//on the screen is now shown: 10 20
//here your piece of code and then the result is;
echo $a .
echo $b;
// the screen now shows: 20 10
Create an application that plays the towers of hanoi. Create a simple user interface (not graphical).
Look up what a palindrome is.
Input: string Output: string is palindrome or not
So write any string (a word or phrase) and check whether it is a pallindrome.
Look up what recursive means! Find examples of recursive functions.
Input: row (array) of numbers Output: numbers sorted Method: recursive
So you create a function that calls itself over and over depending on the length of the array. The function checks whether the number presented from the array is greater or less than the previous number. Store the numbers in the correct order so that the array is sorted.
Calculate the area and circumference of a circle with a given Diameter.
Input: temperature in degrees Celsius Output: temperature in °F and in K
Create a table of student names in a database. Enter student names here at random. Get the list with your code. Display the list sorted by abc.
A= "23" (string) B="34"(string) Output: sum of A and B with a ! so "57!"
The input must be a string, not an int. You can then typecast.
The output must again be a string, so no int.
An input string must NOT contain SQL commands. Think of APPEND/INSERT/DELETE/DROP/..... Input: string Output: string contains SQL or not
a="French" b="German" Create a routine that swaps these 2