1. Please provide a brief explanation on variables. Variables are used for storing the input of a program as well as the computational results during program execution. These are named memory locations. The value stored in a variable can change during the program execution. 2. Please explain an algorithm. An algorithm can be defined as a set of finite steps that when followed helps in accomplishing a particular task. Important features of an algorithm are clarity, efficiency, and finiteness. 3. What is the difference between list and tuple? LIST TUPLES Lists are mutable i.e they can be edited. Tuples are immutable (tuples are lists which can’t be edited). Lists are slower than tuples. Tuples are faster than list. Defined with [] brackets Defined with () brackets 4. What is the difference between Python Arrays and lists? Arrays and lists, in Python, have the same way of storing data. But arrays can hold only a single data type element whereas lists can hold any data type elements. 5. How does break, continue and pass work inside loops? Break Allows loop termination when some condition is met, and the control is transferred to the next statement after loop body. Continue Allows skipping some part of a loop when some specific condition is met, and the control is transferred to the beginning of the loop Pass Used when you need some block of code syntactically, but you want to skip its execution. This is basically a null operation. Nothing happens when this is executed, and control is passed to next statement after pass. 6. What is the difference between for loop and while loop and how to decide which to use? # Loop type Description Schlumberger-Private 1 for loop 2 while loop Is an iterator-based loop, which steps through the items of iterable objects like lists, tuples, string and executes a piece of code repeatedly for a number of times, based on the number of items in that iterable object. This type of loop is especially useful when we know how many times, or iterations, we want to repeat the code. Executes a block of statements repeatedly as long as the condition is TRUE. This type of loop is used when we are unsure how many times we want to iterate through the code block. 7. Schlumberger-Private