Blockly Tutorial: AMT Coding Challenge (OUCC) Finals Texting (Public Preview)

Creator Academy Australia · Beginner ·🛠️ AI Tools & Apps ·2y ago

Key Takeaways

Solves an OUCC coding challenge using Blockly

Full Transcript

today we're going to do a super hard one and you're going to watch me struggle because this is going to be a really tricky question uh and the one that I'm talking about is of course texting okay texting are uh infamously difficult especially if you want to do it in the 5 minutes that it takes to do it uh an O question but we're not going to do it in 5 minutes I'm going to walk you through the logic behind it uh if we were doing it in exam conditions you would Zoom through all the logic but I'll go walk through this so that we don't have to okay so in order to reduce the length of our uh text messages you apply the following rules in order this is really important in order capitalize the first letter of all your words replace the double letters in Words with single letters now remember this only happens inside the word not uh across the whole message remove all the vowels unless a word starts with a vowel remove all spaces so there's a few key skills here first key skill is that you need to be able to capitalize the first letter of all your words and recognize that there is already a shortcut for that using text blocks the text block that we're look looking for is title case Okay title case turns the first letter of every word to be capital letters but remember our message has multiple words so you got to figure out a way to separate out that message into multiple words and then utilize the title case second we need to replace double letters in Words with single letters so you'll have to be able to recognize how to uh store the previous letter and the current letter remove all vowels unless a word starts with a vowel now you can do this with a massive if statement or or you can do it in a quick way using um uh find first occurrence of in the text blocks and then finally remove all spaces and that's going to be easy with our very first uh block that we're going to introduce and that is to create a list using text and then in the end you can go you're going to use the reverse of that create text using a list and then remove all of those spaces the task is to write a program that given a string of lowercase words outputs a string of reduced length by following the rules given above for example Great Big Trees turns into this shortened message GRT BG TR RS so all the vowels are removed all the double letters are removed and also the first letter of every word is capital and all the spaces are removed okay now um it says do not alter any of the um blocks provided that's great okay so all you get is a message and you return with the shortened message very difficult if you don't know what to do okay but those um those four or five skills that I just mentioned are the keys okay first of all you need to create that that string that text message into multiple words because I don't want to have to deal with the whole string all at once that's just crazy because then I'll have to figure out when does a word start and when does a word stop right and I have to count the spaces I don't want to do that I am going to uh create a list okay I'm going to create a variable uh and call it um message list okay message list I'm going to set that message list to be uh the list version of our message the list version of our message so how do I do that I'm going to go into lists and then I'm going to uh scroll down and make a list from text now we've gone through all the basic um blocks in our previous lessons it's really important to know all the blocks inside out otherwise it's very difficult to tackle OUC unless you know all the tools at your disposal make list from text what is the the list that we're going to make we're going to make the list uh from our message with a delimiter that means the separator of all of our all of our list items going to be a space it's not going to be blank it's a space because Great Space big space trees the delimiter of this is the space okay now that we have done that we're going to uh now Loop through each item in the list and do something okay I'm going to go um uh loop through each item in the list each word in the list and then I'm going to populate whatever I create into reduced message okay so reduce message once I see that remember the first thing we do when we see an output is we need to set that variable as soon as you can set that variable as soon as you can because if you don't do that then you might accidentally you might accidentally create a whole bunch of junk variables that float around that you have to convert back and forth and you don't want to do that you want to be able to use the um uh whatever the output is to create uh a running total of your code so set reduce message what is it going to be it's going to be blank text right now right off the bat and now I know that whatever I do with my message list I'm going to populate the reduced message okay uh so I'm staying focused on my task let's Loop through uh for each item I in list message list okay each item I I don't want to call this I I'm going to rename this to be word because I is a word it's a single word in the list so I don't want to uh get confused with all these like um magical um uh variables hop hopping around so for each word I'm going to first of all um you got to notice that it says that unless the word starts with a vow it's going to um uh create um it's you're going to have to remove the vowel so you got to have to remove all the vows except for the first one how do I do that well I'm going to do a trick because some of this is going to help you um remember how it says that it's going to replace the first letter of all your words with a Capital well if you do that then all you have to do is check for the vowels in lowercase right cuz it's never ever going to be lowercase if the first word is already capital okay so here for each word in the message list I'm going to um uh do something I'm going to say Set uh a new variable this new variable is called new word uh set this uh new word to be whatever my word is in title case okay so here I said just go into text and then I say up case title case title case of my word right I've already done the first thing all right first thing all sorted next thing is that um uh it says to replace double letters but here's the thing right I don't need to replace all the double letters first I can replace all the remove all the vows first because just like in trees for example um the the double e turns into a single e but then um you're still going to have to delete it anyway so why why do we need to keep track of uh double e right so um so we need to remove all the valves let's remove all the valves so um set new word to title case word and then I'm going to go and do something like this actually I think we can set this title case uh towards the no actually no that's right this is what I'm talking about this this is a very difficult question all right so I'm going to tackle it the other way I'm going to go through and remove all of my oh no I can remove all of the vs at the very end because I can populate reduced message letter by letter okay so uh when I'm populating that letter by letter then I remove all of the vows all right that okay that okay change your and we're going to do the other the other one okay let's remove the doubles first okay so we will do this uh reduce message I'm going to say to Loop through for each item I in list but I'm not going to do I neither I'm going to rename the variable to be a letter for letter in list for each letter in list oh actually is there a text one this is the thing for each oh no for for for loop I don't get to count counting letters okay so here for each letter in the new word for in this new word uh what I'm going to do is I'm going to keep track of what my previous letter is so I got to create create another variable prev letter um and then I'm going to set it here previous letter is going to be blank I haven't started counting any text yet I I don't know what the previous letter the previous letter doesn't exist yet previous letter for each letter in the new word I'm going to say if if it is not if that letter is not equal to the previous letter and it is not a lowercase vowel then I'm going to add it to reduce message so if the um logic if the letter is not equal to the previous letter and and it is not a uh inside uh it is not a vow okay so if letter is not equal to a previous letter and how do I check if it's not a vow I need to create a variable for what vowels are because lucky doesn't know what a vowel is so you know vowels but this is a special list of vowels this is just the lowercase letter fils because that's really important um uh because I don't want to remove the capitals cuz the only way that turns into capitals is if it's the start of the word remember up here it says the um the words will be F in valid English with no punctuation and it also says that everything is going to be in lower case perfect here vows is going to be text going to be a e IOU this saves us from making a massive if statement and the letter is not in um vowels so how do I check that I go to text uh first in text first occurrence of the intext vows the first occurrence of my letter so what's going to happen if it is a Val then this this whole block here will return a number return the number one if it is the first letter of vowels is it an A or it will return zero if it's not a v right so if this is equal to zero then I add it to the reduce message okay so if this logic is equal to zero math zero done done done all right this is this is looking pretty intense but you I hope you could see that the way that I'm walking through it is very systematic okay if it is all if it meets all these criteria then we add it to reduce message so I'll go into text uh to item reduce message append letter ATT append letter and then I need to set the previous letter to the current letter but when do I set it I set it no matter what I set it every time I Loop through set item uh previous letter to letter am I missing anything nope hit run gr vict perfect one go correct answer is saved okay I hope um uh everybody looks at this question and it it takes a long time right it takes a long time to solve because uh if you miss out on any of the steps if you decide to to make a massive if statement at any point you'll definitely run out of time now we took 15 minutes um to do this question but to be um fair this is a level what level three finals question in intermediate level three question in finals that's the maximum number of points that you can get per question right so you can expect these to be harder but um you can see that I I don't need more than one screen worth of code so um it is it is a very very uh tight um uh way that I've I've done that to code it but I hope everybody enjoyed learning that now this is a an example of really really hard question uh and um a few things need to be adhered to you need to make sure that you know every single block in blockley um uh and when you if you get invited to a finals round then chances are you will know all the tools in blockley uh but you just got to know it inside out know every single little bit to uh to tackle the question uh in the way that needs to be tackled uh and also U make sure that you know how to work with lists lists are really really important now one of the very important parts of this code is that I recognize that a word is actually a list of characters so that's why I can go for each item letter in the list and now letter doesn't have to be letter I just write letter so that I know what it is instead of having I's and J's and K's and things like that right I want to make sure that my code makes sense all right so that is from me today I hope everybody had fun doing this super hard question uh if you have any questions make sure you comment in the comment section below and I will see you again next week bye-bye for [Music]

Original Description

"Texting" question from OUCC Intermediate Finals 2022 Watch me tackle an OUCC finals question live in this preview of our members-only videos! I stream live coding sessions every week, and members can get access to the live streams as well as replays of past lessons. Topics include Scratch, Blockly, Python and OUCC. Join our livestreams by becoming a member: https://www.youtube.com/channel/UC_EJBSPUTFORXV6gbQFdRgA/join This members-only lesson teaches advanced Blockly Tips Texting question.
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Creator Academy Australia · Creator Academy Australia · 0 of 60

← Previous Next →
1 LEGO Wedo 2.0 Kangaroo and Joey Demonstration
LEGO Wedo 2.0 Kangaroo and Joey Demonstration
Creator Academy Australia
2 LEGO Wedo 2.0 Koala Demonstration
LEGO Wedo 2.0 Koala Demonstration
Creator Academy Australia
3 LEGO WeDo 2.0 Eagle vs Rabbit Demonstration
LEGO WeDo 2.0 Eagle vs Rabbit Demonstration
Creator Academy Australia
4 Animatronic Australia: The Kangaroo
Animatronic Australia: The Kangaroo
Creator Academy Australia
5 How Semiconductors Work: 3D Animation
How Semiconductors Work: 3D Animation
Creator Academy Australia
6 LEGO Wedo 2.0 Koala
LEGO Wedo 2.0 Koala
Creator Academy Australia
7 First impressions and unboxing First Lego League: Into Orbit 2018
First impressions and unboxing First Lego League: Into Orbit 2018
Creator Academy Australia
8 FLL Into Orbit Team Ranking Gears talks about Artificial Gravity
FLL Into Orbit Team Ranking Gears talks about Artificial Gravity
Creator Academy Australia
9 FLL Into Orbit team Ev3lution discusses isolation in space
FLL Into Orbit team Ev3lution discusses isolation in space
Creator Academy Australia
10 PI3-BOT (Pie Bot) Prototype
PI3-BOT (Pie Bot) Prototype
Creator Academy Australia
11 Dynamic display stand for LEGO Bugatti Chiron (preview)
Dynamic display stand for LEGO Bugatti Chiron (preview)
Creator Academy Australia
12 Creative Kids TV announcement featuring Creator Academy
Creative Kids TV announcement featuring Creator Academy
Creator Academy Australia
13 LEGO WeDo 2.0 Guided Lesson: Milo
LEGO WeDo 2.0 Guided Lesson: Milo
Creator Academy Australia
14 LEGO SPIKE PRIME: Turtle Prime Demonstration
LEGO SPIKE PRIME: Turtle Prime Demonstration
Creator Academy Australia
15 LEGO SPIKE PRIME "Wheelchair Prime"
LEGO SPIKE PRIME "Wheelchair Prime"
Creator Academy Australia
16 10 Reasons why EV3 is SUPERIOR to SPIKE Prime
10 Reasons why EV3 is SUPERIOR to SPIKE Prime
Creator Academy Australia
17 Your first launch after installing Python: Python for Kids Webinar Highlight
Your first launch after installing Python: Python for Kids Webinar Highlight
Creator Academy Australia
18 What is "Sharpening the Saw": Python for Kids Webinar Highlight
What is "Sharpening the Saw": Python for Kids Webinar Highlight
Creator Academy Australia
19 Why We Use Comments: Python for Kids Webinar Highlight
Why We Use Comments: Python for Kids Webinar Highlight
Creator Academy Australia
20 Build a Scratch Dinosaur Park (Full Lesson)
Build a Scratch Dinosaur Park (Full Lesson)
Creator Academy Australia
21 Scratch 3.0: Cat and Mouse Game Stream (Krunal)
Scratch 3.0: Cat and Mouse Game Stream (Krunal)
Creator Academy Australia
22 Python Tutorial: Make a Toilet Paper Calculator (Full Lesson)
Python Tutorial: Make a Toilet Paper Calculator (Full Lesson)
Creator Academy Australia
23 Scratch 3.0 Tutorial: Making a chatbot that plays 'heads or tails' (Full Lesson)
Scratch 3.0 Tutorial: Making a chatbot that plays 'heads or tails' (Full Lesson)
Creator Academy Australia
24 Getting Started with MicroPython on SPIKE PRIME (old)
Getting Started with MicroPython on SPIKE PRIME (old)
Creator Academy Australia
25 Easter Egg Game Tutorial in Scratch (Full Lesson)
Easter Egg Game Tutorial in Scratch (Full Lesson)
Creator Academy Australia
26 Accessing Weather API with Python (Highlights)
Accessing Weather API with Python (Highlights)
Creator Academy Australia
27 Accessing Translate API with Python (Highlights)
Accessing Translate API with Python (Highlights)
Creator Academy Australia
28 Scissors, Paper, Rock with Scratch 3.0 (Highlights)
Scissors, Paper, Rock with Scratch 3.0 (Highlights)
Creator Academy Australia
29 Making a really scary game with Scratch 3.0 (Highlights)
Making a really scary game with Scratch 3.0 (Highlights)
Creator Academy Australia
30 Making a Lemmings game with Scratch 3.0 (Highlights)
Making a Lemmings game with Scratch 3.0 (Highlights)
Creator Academy Australia
31 Space Navigation Game in Scratch (Highlights)
Space Navigation Game in Scratch (Highlights)
Creator Academy Australia
32 Scratch Supercat Game (Full Lesson)
Scratch Supercat Game (Full Lesson)
Creator Academy Australia
33 Introduction to Robots with LEGO Wedo 2.0 (Full Lesson)
Introduction to Robots with LEGO Wedo 2.0 (Full Lesson)
Creator Academy Australia
34 Getting Started With LEGO Spike Prime (Full Lesson)
Getting Started With LEGO Spike Prime (Full Lesson)
Creator Academy Australia
35 Scratch Walk Cycle Animation Tutorial (Full Lesson)
Scratch Walk Cycle Animation Tutorial (Full Lesson)
Creator Academy Australia
36 Building a Scissor Lift with LEGO Simple Machines (Highlights)
Building a Scissor Lift with LEGO Simple Machines (Highlights)
Creator Academy Australia
37 EV3 datalogging RPM challenge (highlights)
EV3 datalogging RPM challenge (highlights)
Creator Academy Australia
38 Learning about buses with LEGO (Full Lesson)
Learning about buses with LEGO (Full Lesson)
Creator Academy Australia
39 Make "Flappy Bird" in Scratch 3.0 (Highlights)
Make "Flappy Bird" in Scratch 3.0 (Highlights)
Creator Academy Australia
40 "Memory Arrows" game with Scratch 3.0 Lists (Highlights)
"Memory Arrows" game with Scratch 3.0 Lists (Highlights)
Creator Academy Australia
41 Learning about Gear Ratios with LEGO Simple Machines (Highlights)
Learning about Gear Ratios with LEGO Simple Machines (Highlights)
Creator Academy Australia
42 Scratch 3.0 Bouncing Ball with Stretch, Speed and Acceleration (Full Lesson)
Scratch 3.0 Bouncing Ball with Stretch, Speed and Acceleration (Full Lesson)
Creator Academy Australia
43 LEGO SPIKE Prime Order Tracking Robot (Highlights)
LEGO SPIKE Prime Order Tracking Robot (Highlights)
Creator Academy Australia
44 Scratch 3.0 Race Guesser (Full Lesson)
Scratch 3.0 Race Guesser (Full Lesson)
Creator Academy Australia
45 How Banks Work - a quick explanation for kids
How Banks Work - a quick explanation for kids
Creator Academy Australia
46 SPIKE Prime Safe + importance of passwords (Highlights)
SPIKE Prime Safe + importance of passwords (Highlights)
Creator Academy Australia
47 Combination Safe Coding Guide with LEGO SPIKE Prime
Combination Safe Coding Guide with LEGO SPIKE Prime
Creator Academy Australia
48 LEGO SPIKE Prime Parcel Scanning Robot
LEGO SPIKE Prime Parcel Scanning Robot
Creator Academy Australia
49 Building "Addy" the Addition Chatbot
Building "Addy" the Addition Chatbot
Creator Academy Australia
50 SPIKE 2.x PID Balancer with Scratch for SPIKE Prime / 51515: Gyro Girl
SPIKE 2.x PID Balancer with Scratch for SPIKE Prime / 51515: Gyro Girl
Creator Academy Australia
51 What is Procedural Programming
What is Procedural Programming
Creator Academy Australia
52 Zombie game in SCRATCH (plus horrifying zombie facts!)
Zombie game in SCRATCH (plus horrifying zombie facts!)
Creator Academy Australia
53 Swarming Bugs Scratch Game
Swarming Bugs Scratch Game
Creator Academy Australia
54 LEGO Mindstorms/SPIKE Prime Scanner and Printer
LEGO Mindstorms/SPIKE Prime Scanner and Printer
Creator Academy Australia
55 Fishing Game with SCRATCH (For Fathers Day!)
Fishing Game with SCRATCH (For Fathers Day!)
Creator Academy Australia
56 Measuring Paper Plane Speed with SPIKE Prime Line Graphs
Measuring Paper Plane Speed with SPIKE Prime Line Graphs
Creator Academy Australia
57 Comparing Mindstorms Robot Inventor and SPIKE Prime
Comparing Mindstorms Robot Inventor and SPIKE Prime
Creator Academy Australia
58 Code a 'Knock Knock Joke' game in Scratch 3.0
Code a 'Knock Knock Joke' game in Scratch 3.0
Creator Academy Australia
59 Creator Academy Australia Live Stream
Creator Academy Australia Live Stream
Creator Academy Australia
60 Discovering LEGO Mindstorms/SPIKE Gyro Pitch Deadzone
Discovering LEGO Mindstorms/SPIKE Gyro Pitch Deadzone
Creator Academy Australia

Related Reads

📰
How to switch your OpenAI SDK to Flatkey by changing one base_url
Switch your OpenAI SDK to Flatkey by changing one base_url to avoid vendor lock-in and increase flexibility
Dev.to · Hunter G
📰
PodcastorAI Guide: How to Use It, Best Prompts & Use Cases (2026)
Learn to use PodcastorAI to turn scripts into studio-quality video podcast episodes in 15 minutes
Dev.to AI
📰
I built Steno to protect your most sensitive conversations. AI notetaker & notepad. 1200+ GitHub stars, 1000s of downloads
Learn about Steno, an AI-powered notetaker and notepad for sensitive conversations, and its latest release 0.6.4
Dev.to · Darth_Ruzin
📰
Enterprise Storage Is Rebuilding Itself Around AI-Ready Data
Enterprise storage is shifting focus from capacity to AI-ready data governance, driving 22.7% market growth in Q1 2026
Forbes Innovation
Up next
Wix Harmony: Wix's AI Website Builder Explained (2026)
TheFigCo
Watch →