NPTEL – PYTHON FOR DATA SCIENCE
ASSIGNMENT 1 – SOLUTION
1. Answer B - \n
print(object(s), separator=separator, end=end, file=file, flush=flush)
end=’end’ – optional; specify what to print at end. Default is ‘\n’ (line feed)
2. Answer A - The length of the variable name is fixed
3. Answer D - Integrated Development Environment
4. Answer D - %clear
%clear –An easier way to clear the console in Python
5. Answer A – a, b, c = 55
6. Answer C - 3
% - Divides and returns the value of the remainder
7. Answer A: a = b
8. Answer C: 10
9. Answer A: int('10.8')
A float value cannot be converted to an integer
10. Answer B: print('01','Jan', sep='-', end='-2020')
11. Answer A: Semantic error
Semantic errors are problems with a program that runs without producing error
messages but doesn't do the right thing
12. Answer D: 6
// - Division (floor): divides the first operand by the second
13. Answer B : A.2 = 10
The name of the variable cannot have special characters such as ‘ . ‘ (dot), %, $, #
etc, they can only have alphanumeric characters and underscore (A to Z, a to z, 0-9
or _ )
14. Answer A: Displays the current Python version
15. Answer B: Identity Operators
Identity operators are used to verify if two variables point to the same memory
location or not. Identity operators are of two types: (1) is and (2) is not.
16. Answer C: 5
There are 5 operands in the equation.
17. Answer B: Nonetype
The sole value of the type NoneType. None is frequently used to represent the
absence of a value, as when default arguments are not passed to a function.
Assignments to None are illegal and raise a Syntax Error.
18. Answer D: %%=
%%= is not a valid assignment operator in python.
19. Answer D: ≤
≤ is not a valid bitwise operator in python.
20. Answer C: SyntaxError