Nibi's Tech7.4 INTRODUCTION TO PROGRAMMING LANGUAGES
Programming languages are formal languages used to communicate with computers. They act as a bridge between human logic and machine execution.
There are many programming languages, each designed for different purposes.
High-level languages are easier for humans to understand and are closer to natural language. Examples include Python, JavaScript, and Java.
Low-level languages are closer to machine code and are more difficult for humans to read but faster for computers to execute.
Among beginners, Python is one of the most popular languages because it is simple, readable, and widely used in areas like AI, web development, and data analysis.
7.5 INTRODUCTION TO PYTHON PROGRAMMING
Python is a high-level programming language known for its simplicity and readability. It is widely used in education, artificial intelligence, data science, and software development.
In Python, instructions are written in plain text-like syntax, which makes it easier for beginners to understand compared to more complex languages.
For example, to display a message, Python uses a simple instruction like:
print("Hello World")
This simplicity allows beginners to focus more on logic and problem-solving rather than complex syntax rules.
7.6 VARIABLES AND DATA STORAGE IN PROGRAMMING
A variable is a container used to store information that can be used and changed later in a program.
In programming, variables act like labeled boxes where data is stored.
For example, a variable can store a name, a number, or a value that changes over time.
If you assign a value like:
age = 15
It means the variable βageβ now stores the value 15.
Variables are important because they allow programs to work with dynamic information instead of fixed values.
7.7 DATA TYPES (WHAT KIND OF INFORMATION COMPUTERS USE)
Computers work with different types of data. These include numbers, text, and logical values.
Numbers are used for calculations. Text is used for names and messages. Logical values are used for decisions, such as true or false conditions.
Understanding data types is important because computers treat different types of information differently. For example, you cannot add text and numbers together directly without converting them.
7.8 INPUT AND OUTPUT IN PROGRAMMING
Input refers to information that a program receives from a user or another system. Output refers to the result produced by the program after processing the input.
For example, if a program asks for your name and then displays a greeting, the name you enter is the input, and the greeting message is the output.
This interaction between input and output is one of the basic foundations of all software systems.
7.9 CONDITIONAL STATEMENTS (MAKING DECISIONS IN CODE)
Conditional statements allow programs to make decisions based on conditions. This is how computers simulate decision-making.
For example, a program can be designed to check whether a student passed or failed based on their score.
If the condition is true, one action is performed. If it is false, another action is performed.
This logic is similar to real-life decision-making:
If it rains, take an umbrella. Otherwise, donβt.
In programming, this is written using structured conditional logic.
7.10 LOOPS (REPEATING ACTIONS)
Loops are used when a task needs to be repeated multiple times without rewriting the same code.
For example, if you want to display numbers from 1 to 10, instead of writing each number manually, a loop can automate the process.
Loops are powerful because they reduce repetition and make programs more efficient.
There are different types of loops, but the basic idea is always the same: repeat a set of instructions until a condition is met.