So you're getting better at coding? We've got some challenges for you.
So you're getting better at coding. Maybe you've earned some CoderDojo Stirling badges. Now try some of our challenges below!
Start completing challenges today:
Scratch: Going to School
Websites: Introduction to Scratch
Coding: Scoring a Game
Scratch is a nice programming language for learning how to code. If you haven't used Scratch before, you can do our Scratch badges to get started. If you have used Scratch before, pick a challenge below and do it!
Make a theatre stage with a band on it: a drummer, a guitarist, a singer, and anyone else you want. When you click on a person (or their instrument), the instrument sound should play. So when you click on the drums, you hear drums!
More advanced: Try clicking your band members at the right time, so it sounds like a proper song!
Make a story about a bear searching for his dinner. The bear should move around, and tell the following joke to a frog:
Create a maze game. If you collide with a wall, you get teleported to the start, and told “you clumsy oaf”!
Make an animation of your name, so each letter does something cool like make a sound, or move around or change colour. I’m called GREG, so the G might spin around, the R might change from red to blue, and so on. The animation should start when the Green Flag is clicked.
More advanced: Make the animation cooler. You could make the background change, or make a bird fly around, or make the letters do things when you click on them.
Create a game where the player gets points when the cat catches a mouse, and loses points when the cat steps in a dog-poo.
More advanced: can you make this game two-player?
Build an aquarium with fish swimming around and plants at the bottom. The fish should turn round when they hit the aquarium edge.
More advanced: Add a shark into the aquarium that is controlled with the arrow keys. Make the fish run away when they bump into the shark.
Make a game about a space miner:
Make a Hide and Seek game with the Scratch Cat: the Cat will appear somewhere on the screen, then vanish after 2 seconds. 6 seconds later, the Cat will appear somewhere else on the screen, then vanish again after 2 seconds. It does this forever. The player gets one point when they click on the cat, and lose a point if they click on the background.
Make a game about escaping a graveyard. You start at one side of the graveyard, and have to escape through a gate on the other side. The graveyard has grave-stones in the ground, and ghosts that move around. If you collide with a grave-stone or a ghost, you get teleported to the start.
More advanced: Make the graveyard more spooky. What about making an invisible ghost appear when the player hits a gravestone? Maybe it says “boo!” (record the sound effect)
Make a game about someone doing a parachute jump, and having to dodge moving clouds. If they hit a cloud, they lose the game.
More advanced: make things harder, with more clouds moving randomly at different speeds. You could also keep score by counting how many clouds the parachutist dodged. Or make things look cooler by changing the background: what about thunder and lightning, or snow?
Make a quiz where the player has to multiply random numbers together. "What's 2 times 7?". "14". "Correct!".
More advanced: make the quiz ask 10 questions, and keep a score of correct answers. And do more fun stuff when the player gives a right answer (yay!) or wrong answer (boo!).
Make a scene with a windmill (or wind turbine) and a cloud. Make the windmill turn and the cloud move across the sky. Now here's the fun bit: make the windmill turn faster the louder you whistle (or yell) into your computer's microphone. The cloud should move faster too. The louder you whistle, the stronger the wind!
Make a game that measures your reaction time: how fast you can click when Scratch cat changes from his normal orange colour to blue. At the end of the game, show your reaction time (it will be in milliseconds, which is a second divided into 1000 parts). What's the fastest you can click?
Make a Scratch program that generates random insults :-) Scratch cat first asks for your name, then insults you. Here goes..
Write a game about flying to the moon. There should be three stages in your game: one set on Earth; one in space and one on the moon.
To start the rocket the player should press the space bar five times. Then the rocket should fly into the air. When the rocket reaches the top of the screen, the background should be changed to the next background (e.g. from Earth to space). Along with placing the rocket at the bottom of the screen again. The player should be able to move the rocket left and right using the arrow keys. There should be Aliens and other space-ships flying around. If the player touches one of these they lose the game. When the player reaches the last stage (the moon) a target should appear. The target should be placed at the top of the screen. If the player hits the target then they win the game.
For a spaceship sprite look in the sprite library (they'll be found in flying).
To count the number of times the player has pressed space make a variable (found under data). Then every time space is pressed add one to this variable. Use the wait until block to make the sure the rocket doesn't fly off until the variable equals five. Ask a mentor for help if you haven't used variables before.
To change the background check whether the y coordinate is bigger than 180, then use the switch background block.
If you manage to complete the above try and place the target at the bottom of the screen. Then have the rocket start at the top and move down the screen (towards the target).
Write a small game about popping balloons. In the game the balloons should float from the bottom to the top of the screen. When the player clicks on a balloon then it should disappear from the screen, and a popping sound should be played. Then one should be added to their score. There should be other items floating up the screen; if the player clicks on any of these they should lose a point.
So you're going back to school - you'll need to make sure you've got a pencil, notebook and calculator.
Fortunately, it's raining school supplies. Your sprite needs to walk back and forth across the screen catching pencils, notebooks and calculators in their backpack. Set up a timer so that players have one minute to collect as many as they can. Set up a counter to count how many items they catch.
Make your own version of a classic 1980s game called "Frogger". Check out this video. The aim of the game is to guide a frog from the bottom of the screen to the top of the screen, whilst crossing lanes of a busy road. Each lane contains moving cars, buses, cyclists and other vehicles - don't let the frog get run over! The player moves the frog using the arrow keys (hopping forwards, back, left or right). The player wins by guiding the frog safely to the top of the screen.
Create a Halloween scene: for example a spooky forest or a graveyard. When you click on anything in the scene, something scary should happen. A spider drops from this tree; an owl flies out of that one; a ghost pops out from behind a gravestone; a witch flies cackling across the moon. How many spooky surprises can you put in?
Santa needs help dropping presents down chimneys. Make a game where Santa flies across the sky over some houses with chimneys. When the mouse is clicked, Santa drops a present which falls downwards. If the present hits a chimney, you score 1 point. If the present hits something else (like a roof), you score nothing. In either case, the present vanishes, and you get to try again. You win once you've scored 10 points.
Scratch Cat has made a New Year Resolution not to eat cake. Write a game where Scratch Cat has to dodge cakes that fly round the screen. If Scratch Cat touches cake, he loses a life (and the cake vanishes - yum yum!). Scratch Cat has 9 lives. When he runs out of lives, the game finishes. The player should then be told how many seconds Scratch Cat survived.
Make a scene of a robot disco! There are two robots dancing, waving their arms and their legs. There should be crazy electronic music playing, and some flashing lights. Make it a cool robot disco.
Make an easter egg hunt game - you win by finding 10 easter eggs hidden behind things in a country scene. When you click on a hidden egg, it becomes totally visible for 2 seconds, then vanishes.
It rains a lot in April. Make a game where you dodge raindrops. Get hit by 3 raindrops, and the game finishes. The player should be told how many seconds they survived.
There are some good video tutorials on YouTube that show you how to make cool things with Scratch. Follow along with this 10 minute video tutorial, where you learn how to make a zombie survival game: the player is attacked by zombies, and can run around and shoot the zombies.
Once you have your own zombie game working, then you can improve it how you want, or keep watching more video tutorials in the series. There are 9 more videos: part 2, part 3, part 4, part 5, part 6, part 7, part 8, part 9 and part 10.
There are plenty more video tutorials on YouTube about making games in scratch: try searching for "Make a scratch game". For example, here is a video playlist that shows how to make a 'cat chasing mouse' game, a 'whack a mole' game, and more.
Scratch Cat has gone on holiday to the beach. He will need regular food, drink and sunscreen to enjoy himself. If he doesn't get enough of each then he'll be hungry, thirsty and sunburnt. Scratch Cat will then come home from holiday early as he feels unwell. Sadness.
Make a "virtual pet" game where you keep Scratch Cat on his beach holiday for as long as possible. You will need to give him food, drink or sunscreen, depending on what he needs. The basic idea is that you have "variables" that show how Scratch Cat is feeling, like: "Hungry: 4". Scratch Cat gets hungrier over time, so the variable starts at zero and increases 2 points every 5 seconds. The player can reduce points by feeding Scratch Cat: they do this by clicking on some cat food. If the "Hungry" variable gets to 20 points, then Scratch Cat feels unwell and goes home early: the game finishes. You will need three different variables: "Hungry" (fixed by cat food), "Thirsty" (fixed by a water bowl), and "Sunburnt" (fixed by sunscreen).
To get started, let's deal with Scratch Cat being hungry:
Learn how to make an adventure/RPG (role-playing game) game by following along with this 10 minute video tutorial.
Make a Scratch program that generates random spy names :-) Scratch cat first asks for your name, then tells you your spy name. Here goes..
To finish things off, let's replace Scratch cat with M: head of the Secret Service in James Bond films. Make a new sprite for M: they should be dressed in normal clothes. Now add an extra "spy" costume for M: they should be dressed like a spy, with dark glasses, a fake moustache, and maybe all in black. When M asks your name, show them in their normal costume. But when M tells you your spy name, show them in their spy costume. Cooool.
Make a story about you going to school. There will be 3 screens (each using a different backdrop):
If you’ve never built a website before, do our badge called Get your own website on the Internet. If you have built a website before, pick a challenge below and do it!
Create a website about the solar system. It will need a start page describing the solar system, and a page about every planet. You could even do pages about different space missions involving astronauts.
Create a website about the place where you live. Let’s say you live in Stirling. Where is it? How old is it? What would you show someone who came to visit? What interesting things can you do there?
What do you want for Christmas? Let Santa (and mum, dad, gran and anyone else) know with your own website.
Your website should have descriptions and pictures of the items you want and links to where they can be bought. You could prioritise the items with a star rating to say how much you want that item, or organise it by price so everyone can find the right gift for you!
More advanced: Add some Christmas style and Christmas tunes to get everyone in the present-buying mood!
Chemistry, computing, psychology, microbiology, astronomy…. how many types of science can you think of?
Make a guide to science: your website should have one page for each type of science. Explain what it is. Include pictures of famous scientists or discoveries, and links to other websites so that your readers can find out more.
Make a website game about a haunted house. Each webpage is a room in the house, and describes the spookiness happening in the room. The links on a room’s webpage take the player to other rooms nearby.
The player starts outside the haunted house (on the website’s main page). They then choose which links to follow to take them though the haunted house, and out the back door!
So you watched the Olympics? There were loads of cool sports: swimming, triathlon, fencing, …
Make a website about the Olympics. You can have pages about different sports and athletes. Maybe a page about Rio de Janeiro in Brazil. Include pictures and videos (try including a youtube video). Link to other websites where your readers can find out more.
Make a webpage with lots of animal pictures. When you click on a picture ("sheep"), an alert box should pop up with the animal noise ("baa").
Make a website for Bob's Bakery.
"My name's Bob, and I run Bob's Bakery. We make lots of cakes and tasty things: chocolate cake, gingerbread men, jam doughnuts, ring doughnuts, strawberry tarts, and lots more. I'd like to start selling my cakes on the internet, so will need a website. I reckon it needs:
I bet you've got a few favourite films. So make a website about them! You will need:
Make a website for Bob the Builder.
"I'm Bob the Builder. I build houses: houses for people, dog-houses, dolls-houses, tree-houses.. If it's a house, I can build it. I want a website so people can find me on the Internet, see what I do, and contact me if they're interested. Hopefully I'll get some new customers! I reckon the website needs:
My favourite game. Write a small website about your favourite game(s). The website should contains:
A short of description of the game. What's about it? What are the goals of the game? How long does it take to complete? Is there a story? Who's it developed by? And any other relevant.
A link to the game site
Images and videos of gameplay
Write a website about your summer holiday. The site should have a page for each activity you have done. Every page should have a brief description of what you did, who you were with and where you were. Along with some pictures of the place. Every page should link to the others.
Write a website about the teachers in your school. Each teacher should have their own page, describing what they teach, how much homework they give, how strict they are, what their classroom is like, etc. You could add a drawing of each teacher to help new pupils identify them. Don't forget the Head Teacher! You could arrange the front page so that the teachers are organised by subject.
Make a website with the best memes ever. It should be possible to view memes by animal type, subject and year, so you'll need different web pages for this.
How text appears on a webpage depends on which font is used. For example, we could use the Courier font, or Verdana font. Write a webpage that shows the same piece of text with different fonts: use the sentence "the quick brown fox jumped over the lazy dog". The text will feel different, depending on the font used. Try finding fonts that look official, funny, old or futuristic. What's your favourite?
Twine is an online tool for telling interactive stories. Here are two examples:
Make a "Choose Your Own Adventure" story with Twine called "A Day in the Life of Timmy the Dog".
If you don't know how to use Twine to make stories, then do the "Make Stories with Twine" challenge first.
To start you off, your first page might look like:
Timmy the Dog is sniffing the rubbish bin outside his house. Suddenly he hears a rustle behind him, and sees Sooty the Cat staring. Timmy: * Walks up to Sooty, and tries to make friends. * Bounces up to Sooty, and starts a fight. That cat needs a lesson. * Runs awwaaaaay! Sooty is scary.Each choice is a link to another page, where the story continues. So what happens when Timmy runs away, or starts a fight?
Complete the CSS Selector Game, to learn about CSS selectors. It's got 32 levels, so should take some time!
If you're not clear on what a CSS selector is, you might want to do one of these courses first:
Make a website about different Easter traditions around the world - a page for each one. For example, eggs are rolled down hills in the United Kingdom, whilst Spain holds processions to celebrate Semana Santa (Holy Week). Use pins on Google Maps to show where each tradition happens.
CSS lets you write text and backgrounds in different colours. Write a webpage that shows the same piece of text with different background and text colours: use the sentence "the quick brown fox jumped over the lazy dog". Use a large font size so you can get a good look at the colours. Choose colour combinations that are readable. Which combinations don't work together, and why? What's your favourite?
It's the summer holidays. Are you going somewhere nice? Paris? Ooh la la!
Imagine you're the Paris Tourist Board (or any other holiday destination). Make a website for tourists visiting Paris. You will need:
Make a website telling people about Scratch: what it is, and what you can do with it.
You can link to Scratch games and stories you like. If you've made some Scratch games and stories yourself, then link to them as well, and write down what was interesting or challenging about making them.
Show off your Scratch knowledge!
Here are two online environments where you can start coding immediately (or use whatever setup you want):
Write a program that asks someone their name, then outputs it in reverse. So “GREG” becomes “GERG”.
Write a program that asks for a country name, then outputs the capital city. So “France” returns “Paris”.
Write a program that plays ‘rock paper scissors’:
Write a program that plays ‘hangman’. The player guesses letters to complete a secret word. You decide how many turns they get. On each turn:
Write a program that counts the number of words in a sentence. For example, for “i am an example sentence”, the program would print 5 (words).
Then improve your sentence analyser:
Write a calculator that can add, subtract, multiply or divide two numbers. Make the calculator accept the two numbers and command one line at a time. Like:
More advanced: make the calculator accept everything on one line, like: 2 + 3.
Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print “FizzBuzz".
Write a program that prints out the first 100 numbers in the Fibonacci sequence. In the Fibonacci sequence the first two numbers are zero and one. Every number after that is the sum of the previous 2 numbers. So the first seven numbers are: 0 1 1 2 3 5 8.
Write a program that turns a sentence into a secret message by replacing each letter with the next letter. So the letter ‘a’ is replaced by ‘b’, and ‘f’ by ‘g’, etc. Here’s an example:
Hint: letters are represented inside a computer as numbers. This is called ASCII: so an ‘a’ in ASCII is 97. You’ll need to convert the sentence letters into ASCII, do some addition, then convert them back again. Google to learn about ASCII, and how you convert letters to ASCII (and back again) in your particular programming language.
More advanced: so you’ve written a program that ‘encrypts’ a sentence into a secret message. Write a ‘decrypt’ program that turns a secret message back into the original sentence.
Write a program that outputs whether two phrases are anagrams of one another. For example:
Write a program that outputs whether a given number is a factorial (or not).
A factorial of a particular number is that number multiplied by all numbers below it. So 5! (meaning 5 factorial) = 5 * 4 * 3 * 2 * 1 = 120.
Calculating 5! is easy. But we want to reverse this. Write a program that tells us that "120" is "5!". The program should work for any number, either reporting that that the number is a factorial, or "NONE" if it isn't. For example:
Write a program that lets you create and manage a 'to-do list'. You should be able to: add an item, delete an item, and view the whole list (of items). Here's my example to-do list:
Write a game that measures your reaction time: how fast you hit the space-bar when told 'hit it!'. At the end of the game, show your reaction time in milliseconds (a second divided into 1000 parts). What's your fastest reaction time?
Make a program that generates random insults :-) The program first asks for your name, then insults you. Here goes..
Write a small program that takes in a number and then prints off a triangle of that height. Here is an example:
Please enter the height of the triangle: 5 Output: # ## ### #### #####
The program should only accept whole numbers between 3 and 10.
Once you've finished the basic version, try and produce the following output:
Please enter the height of the triangle: 5 Output: ## #### ###### ######## ##########
Write a small program that takes an amount of change, and then works out the minimal coins required to make it. You may only use the: 50, 20, 10, 5, 2, and 1 pence coins.
Input: 0.73 Output: 1 x 50 1 x 20 1 x 2 1 x 1
The program should only accept positive numbers and the input must never be bigger or equal to one.
So you're going back to school. Write a program that manages your school timetable. It should record which subjects you take during your school day. E.g.:
Input: MON-PERIOD2 Output: ENGLISH
Getting your driving licence requires you to pass a "theory test". Write a program that lets you practice the theory test: the program asks you a set of multiple-choice questions, tells you whether you correctly answered each question, and tells you your final score at the end. Here's an example question:
You will find that driving smoothly can:
Write a program that takes a time in 24 hour numeric form, and outputs it as words.
Can you make the computer actually speak the time as words, so you have a real speaking clock?
Thanks to Reddit dailyprogrammer
Write the smallest possible program to print all the lyrics to the "Twelve Days of Christmas":
On the first day of Christmas my true love sent to me: a Partridge in a Pear Tree On the second day of Christmas my true love sent to me: two Turtle Doves and a Partridge in a Pear Tree On the third day of Christmas my true love sent to me: three French Hens ...
To start with, get things working by using numbers (rather than words) for the gift counts:
On the second day of Christmas my true love sent to me: 2 Turtle Doves and 1 Partridge in a Pear Tree
There is a light that switches on when someone enters the room, and switches off when they leave. If multiple people are in the room, the light stays on until the last person leaves. Write a program that outputs how long the light stays on, given a list of when people entered and left the room.
More input and output:
Input: 2 4 3 6 1 3 6 8 Output: 7
Input: 6 8 5 8 8 9 5 7 4 7 Output: 5
Can you change the program to work with more precise times? E.g 09:00 09:25.
Thanks to Reddit dailyprogrammer
Write a program that translates English into Leet Speak (or vice versa). Examples:
A -> 4 B -> 6 E -> 3 I -> 1 L -> 1 M -> (V) N -> (\) O -> 0 S -> 5 T -> 7 V -> \/ W -> `//The program takes in one word or phrase per line, and converts it to (or from) l33t:
I am elite. Da pain! Eye need help! 3Y3 (\)33d j00 t0 g37 d4 d0c70r. 1 n33d m4 p1llz!Challenge output:
I am elite. -> 1 4m 37173 Da pain! -> D4 P41(\)! Eye need help! -> 3Y3 (\)33D H31P! 3Y3 (\)33d j00 t0 g37 d4 d0c70r. -> Eye need j00 to get da doctor. 1 n33d m4 p1llz! -> I need ma pillz!
Thanks to Reddit dailyprogrammer
Code the game of 'Noughts and Crosses':
a b c |---|---|---| 1 | | | | |---|---|---| 2 | | | | |---|---|---| 3 | | X | | |---|---|---| Player one, you are noughts. Enter your move: b2 a b c |---|---|---| 1 | | | | |---|---|---| 2 | | O | | |---|---|---| 3 | | X | | |---|---|---| Player two, you are crosses. Enter your move:
Write a program that converts a number of seconds into years/months/weeks/days/hours/minutes/seconds. Assume that
there are 365 days in a year, and 28 days in month.
Write a 1-player version of the game 'Battleship'. Start with the simple version:
a b c d e f g h i j |---|---|---|---|---|---|---|---|---|---| 1 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 2 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 3 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 4 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 5 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 6 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 7 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 8 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 9 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 10| | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| Player, enter your move: d2 a b c d e f g h i j |---|---|---|---|---|---|---|---|---|---| 1 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 2 | | | | x | | | | | | | |---|---|---|---|---|---|---|---|---|---| 3 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 4 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 5 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 6 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 7 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 8 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 9 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 10| | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| HIT! Player, enter your move: a4 a b c d e f g h i j |---|---|---|---|---|---|---|---|---|---| 1 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 2 | | | | x | | | | | | | |---|---|---|---|---|---|---|---|---|---| 3 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 4 | ~ | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 5 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 6 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 7 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 8 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 9 | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| 10| | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---| MISS :( Player, enter your move: ..
The more advanced version of battleship has ships that are a line of squares, and are placed horizontally or vertically:
Make a calendar program. The user can:
What do you want to do? 1. Add an event 2. List events 3. Delete an event => 1 Please enter the day of the event: => 2018-06-29 Please enter the event information: => Attend CoderDojo Event "Attend CoderDojo" added for 2018-06-29 What do you want to do? 1. Add an event 2. List events 3. Delete an event => 2 Please enter the date range to list events from (e.g. year: "2018", or month "2018-06", or day "2018-06-29" => 2018-06 Events in 2018-06: 2018-06-29: "Attend CoderDojo" What do you want to do? 1. Add an event 2. List events 3. Delete an event => 3 Please enter the date range to list (deletable) events from (e.g. year: "2018", or month "2018-06", or day "2018-06-29" => 2018-06 Deletable events in 2018-06: 1. 2018-06-29: "Attend CoderDojo" Which event do you wish to delete? (enter its number) => 1 Event deleted: 2018-06-29: "Attend CoderDojo"
What if you need to find particular letter sequences in a large piece of text, like all email addresses, or all phone numbers? You'll need something called a "regular expression" for that. A regular expression lets you define the pattern of letters that you're looking for, and then find all letter sequences matching that pattern. For example, the regular expression "ab+a" says "match sequences of letters that start with 'a', are followed by any number of 'b's, and end with another 'a'. So this regular expression matches "aba", "abba", "abbba" and so on.
Learn about regular expressions by playing the RegexOne game. The game gradually teaches you more complicated regular expressions through a sequence of exercises. When you've finished this, you can play around with regular expressions at regex101.
Write a program that takes two words, and says whether the second word can be made from the first by removing one letter. All other letters must remain in the same order. For example:
For every word in the dictionary, output all other words that can be made by removing one letter from the first (using what you just coded :-). For example:
Thanks to Reddit dailyprogrammer
5 friends (called Alex, Ben, Caitlin, Dean and Erin) are playing a game, and keeping track of scores. When someone scores a point, their initial (letter) is typed in lowercase. When they lose a point, their initial is typed in uppercase. So "aaAb" means in that round Alex (player "a") gained two points then lost a point, then Ben (player "b") gained a point. Write a program which takes in the recorded scores, and gives the total scores for each player, ranked high to low. So "aaaAb" would be: a:2, b:1.
abcde dbbaCEDbdAacCEAadcB EbAAdbBEaBaaBBdAccbeebaecChallenge output:
abcde -> a:1, b:1, c:1, d:1, e:1 dbbaCEDbdAacCEAadcB -> b:2, d:2, a:1, c:0, e:-2
Thanks to Reddit dailyprogrammer
At Stirling CoderDojo, we have micro:bits to play with. Ask a mentor if you would like to use one. A micro:bit is a cool little computer with LEDs, a compass, motion detection and temperature detection. So you can make it to do cool stuff like show the temperature when you shake it! There’s a web-based Block Editor (like Scratch) for writing and testing code. When you’re happy with the code, you need to transfer the code to the micro:bit. To do this: