Classroom Notes: Unit 1.4 Introduction to text-based programming
Question and Answers
Q1: What is the difference between block-based and text-based programming languages?
Block-based vs. Text-based Programming Languages
Block-based Programming:
- Uses drag-and-drop blocks that fit together like puzzle pieces.
- Each block represents a command (like "move forward" or "repeat").
- Example: Scratch or Blockly.
- Good for beginners because you don't have to worry about spelling or syntax errors.
Text-based Programming:
- Uses typed code written with words and symbols.
- You must follow the exact rules (syntax) of the language.
- Example: Python, C, or C++.
- More powerful and flexible, requires practice to avoid errors.
Q2: What is an IDE?
IDE stands for Integrated Development Environment. It is a special software tool that programmers use to write, test, and fix code all in one place.
Q3: What are the components of an IDE?
The main components of an Integrated Development Environment are:
- Code editor: Where you type your program.
- Debugger: Helps find and fix mistakes (bugs).
- Compiler/Interpreter: Translates your code into a language the computer understands.
- Extra tools: Like autocomplete, suggestions, and project organizers.
Q4: List some of the common output errors in Python.
Common errors in Python
print statements are:
| Code | Error |
|---|---|
rint("Hello") |
print is spelt incorrectly |
print "Hello" |
missing brackets |
print(Hello) |
missing double quotation marks |
print ("Hello) |
missing one quotation mark |
PRINT("Hello") |
print should be lowercase |
output("Hello") |
output should be print |
Q5: Write a Python program to output a list of facts about yourself.
print("My Name is Lokesh")
print("Grade 6 PHEONEX")
print("School: NIHOC The International School")
print("I like to play football")