Private: Code with Blockly
About Lesson

Before starting, we would like to congratulate and appreciate you for making it this far. By now you have learned the basics about mathematics in coding, loops, logics, lists, and functions. These cover about all the essential concepts that are common in all programming languages.
In this unit, we will simply take a quick look at all the topics you have learned till now. We will also provide you with some practice questions that you can solve to improve your grasp on these topics

Topic 1: logics
⦁ The primary role of logics is to solve problems that come with inherent decision points.
⦁ Logics can have multiple outputs based on single or multiple conditions. For example,
⦁ A store owner wants his code to display open when time is from 8AM to 10 PM, and closed otherwise. How does he do that? He has to build a logic with two conditions. Code will show open only when both these conditions are fulfilled.
⦁ Condition 1: time > 8AM
⦁ Condition 2: time <10Pm
⦁ You can try building this code. Two put two conditions , use the following block:-

Topic 2: loops
⦁ Loops are used when you have to repeat an action multiple times. Lets say you are playing Mario. Your character has 3 lives. So it will be resurrected even if you die. But after your character dies more than three times, it will be taken to starting point.
So how does the game does it? Simple, it runs a loop 3 times and saves your progress within the game. But once you die more than 3 times, the loop breaks and you are taken to start of loop and game.
⦁ In the topic on loops, we have practiced multiple questions. To practice some more you can solve the following questions
⦁ Write a code that calculates the values of square of 1, 2, 3, 4, and 5.
⦁ Hint: build a while loop with condition {I=1, I<=5 , i=i+1} and find the value of i^2.
⦁ Write a code that finds the square root of numbers from 55 to 49
⦁ Hint: build a while loop with condition {I=55, I>=49 , I=i-1} and find the square root of i.

Topic 3: lists
⦁ Lists are used to store and use multiple values together. You can find its applications from generating multiplication table to history in a application such as google.
⦁ As you progress further in field of programming, you will realise lists are one of the most important concept in coding.
⦁ You can practice further by solving these questions
⦁ Build a list with 10 entries containing values of sin for 0, 10,20,30,40,50,60,70,80, and90.
⦁ Hint build a loop for {I=0, I<=90 , I=i+10} and find the value of sin i.
⦁ Use set list block to store these values of sin.
⦁ Build a list with entries 1,2,2,3,3,3,4,4,4,5,5,5,5,5, and so on.
⦁ Hint use the following blocks.

With this we conclude our lesson on blockly and basics of coding. Further on you can learn in details about programming languages like C, C++, Java, Python, PHP and many more on karkhana academy.
Remember, coding is like any other activity. The more you practice, the better you get. You can find many more practice activities online. If in any doubt, you can visit the lessons any time.

So keep practicing and keep learning.

Fill in the form for S’O’A Fablab Orientation 2021.