CSE 6040X COMPUTING FOR DATA
ANALYSIS ACTUAL SCRIPT WITH 100
PERCENT CORRECT ANSWERS
◉ join list in Python
Answer: ''.join([list])
◉ return the largest integer not greater than x
Answer: math.floor()
◉ return the smallest integer not less than x
Answer: math.ceil()
◉ python round call
Answer: round(x, 2); first argument is the number and the second
argument is the precision after the decimal point
◉ list comprehension with if-else statement
Answer: [f(x) if condition else g(x) for x in sequence]
◉ list comprehension with if statement
Answer: [f(x) for x in sequence if condition]
ANALYSIS ACTUAL SCRIPT WITH 100
PERCENT CORRECT ANSWERS
◉ join list in Python
Answer: ''.join([list])
◉ return the largest integer not greater than x
Answer: math.floor()
◉ return the smallest integer not less than x
Answer: math.ceil()
◉ python round call
Answer: round(x, 2); first argument is the number and the second
argument is the precision after the decimal point
◉ list comprehension with if-else statement
Answer: [f(x) if condition else g(x) for x in sequence]
◉ list comprehension with if statement
Answer: [f(x) for x in sequence if condition]