What is a sequence in programming?
A sequence is the order in which instructions are executed, one after another, in a program.
What is a variable?
A variable is a named storage location in memory that holds a value which can change during program execution.
How do you assign a value to a variable in Python?
Use the assignment operator '='. For example: age = 15.
What are the three basic data types mentioned?
Integer (whole numbers), string (text), and boolean (True/False).
What is an integer?
An integer is a whole number, positive or negative, without a fractional part, e.g., 42 or -7.
What is a string?
A string is a sequence of characters, such as letters, digits, and symbols, enclosed in quotes, e.g., 'Hello'.
What is a boolean?
A boolean is a data type with two possible values: True or False, often used in conditions.
How do you take input from the user in Python?
Use the input() function. For example: name = input('Enter your name: ').
How do you produce output in Python?
Use the print() function. For example: print('Hello, world!').
What is the result of the expression 7 + 3×2?
13, because multiplication is performed before addition (operator precedence).
How do you concatenate two strings in Python?
Use the '+' operator. For example: 'Hello' + ' ' + 'World' gives 'Hello World'.
What is a high-level programming language?
A language that is easier for humans to read and write than machine code, such as Python.
What is debugging?
Debugging is the process of finding and fixing errors (bugs) in a program.
What is an algorithm?
An algorithm is a step-by-step set of instructions to solve a problem or perform a task.
What is the purpose of comments in code?
Comments are notes in the code that are ignored by the computer but help humans understand the program.
What is the difference between a variable and a constant?
A variable's value can change, while a constant's value stays the same once set.
What does the input() function return?
It returns the user's input as a string.
How do you convert a string to an integer in Python?
Use the int() function. For example: int('42') gives 42.
What is a syntax error?
A syntax error occurs when the code does not follow the rules of the programming language, so it cannot be run.
What is a runtime error?
A runtime error happens while the program is running, such as dividing by zero.
What is a logic error?
A logic error is a mistake in the program's logic that causes incorrect results, even though the program runs without crashing.
What is the order of operations in Python?
Python follows standard arithmetic precedence: parentheses, exponents, multiplication/division, addition/subtraction.
What is the purpose of the '=' operator?
It assigns a value to a variable. For example, x = 5 stores 5 in x.
What is the difference between '=' and '==' in Python?
'=' is assignment, while '==' is a comparison operator that checks if two values are equal.