What is Programming
Several movies and TV shows portray programmers to be typing a series of characters furiously on a glowing computer screen. However, modern programming is not that dark. Programming can be described as the act of entering instructions for a computer to perform. In other words, its the act of talking to a computer. You can ask the computer to send you an email, find the nearest restaurant, book a flight or communicate with another computer, among several other things.
Programming, as we see, is a creative task. It's similar to constructing a structure using LEGO blocks. You start with a basic idea of what you want your castle to look like and list of the available blocks. Then you start building. The best part about programming is that all the required blocks are inside a computer, you don't have to buy any additional blocks.
Some basic commands in English while compared to a program could be:
"If this condition is true, then perform the following action. If not, then perform the other action."
Task: If x is true, then print true, otherwise print false
if x == true: # -> if x is true print("true") # -> then print true else: # -> if not print("false") # -> then print false
"Perform this action multiple times."
Task: Stop the program when a number reaches the value of 15
number = 10 # -> Create a new number with the value 10 while(number<15): # -> while the number is below 15 number = number + 1 # -> we keep increasing the value of number, hence the while statement makes sense
"Keep performing this action until you find the right value."
Task: Find the number 5 in a list of given numbers
listExample = [1,2,3,4,5] # -> We make a list with 5 numbers for x in listExample: # -> For every number in the list if x == 5: # -> if the chosen number is 5 print("Found") # -> then we print found
Note: The programming instructions are referred to as the source code. The code in the example is written in Python, and is executed line by line.
This is just the beginning, we are about to dive deep into a whole new world of Programming. The tasks or commands written above might seem a bit hard, or messy, or strange, but don't worry. These will help us in making something very applicable in a every context. :sunglasses: Keep going!