4Q CL
How do you insert COMMENTS in Python code?
# This is a comment
What is the correct file extension for Python files?
.py
Which operator can be used to compare two values?
==
What signifies the end of a statement block or suite in Python?
A line that is indented less than the previous line.
A variable that can only have two values, True or False.
Boolean
bool('False')
False
Which one is a legal variable name?
Myvar _myvar My_var myVar1
elect which is true for loop
Python's for loop used to iterates over the items of list, tuple, dictionary, set, or string. With the for loop we can execute a set of statements, once for each item in a list, tuple, set etc.
Vlookup()
The Vlookup function can be used to compare a value that's between two values or for an exact value. The values of the first column must be in descending order.With this function, the comparison table is always read vertically.
Suppose cells A2:B20 contain a table with product numbers in column A and product prices in column B. What does the formula =VLOOKUP(A25,A2:B20,1,FALSE) return?
The number for the product in column A (or #N/A if the exact product number can't be found).
Suppose cells A2:B20 contain a table with sorted product numbers in column A and product prices in column B. What does the formula =VLOOKUP(A25,A2:B20,2) return?
The price for the product found in column A (or #N/A if the exact product number can't be found)
Suppose cells A2:B20 contain a table with product numbers in column A and product prices in column B. What does the formula =VLOOKUP(A25,A2:B20,2,FALSE) return?
The price for the product in column A if the exact product number corresponding to A25 can be found, or #N/A if not.
Is Python case sensitive while dealing with identifiers ?
True
bool("")
True
Which of these collections defines a LIST?
["apple", "banana", "cherry"]
Which statement is used to stop a loop?
break
How do you start writing a for loop in Python?
for x in y:
Which of the following are valid if/else statements in Python, assuming x and y are defined appropriately
if x < y: print('foo'); print('bar'); print('baz') print("foo") if x > y else print("bar")
How do you start writing an if statement in Python?
if x>y:
What is a correct syntax to output "Hello World" in Python?
print("Hello World") print('Hello World')
Which function displays a message on the screen in Python?
print()
Evaluate (to true or false) each of the following expressions: 14 <= 14 14 < 14 -9 > -25 -25 > -9
true false true false
How to swap two variables in one line ?
x,y=y,x
How do you create a variable with the numeric value 5?
x=int(5) x=5