What is the expected behavior of the following code?
It will:
A. print 0
B. cause a runtime exception
C. prints 3
D. print an empty line
What is the expected behavior of the following code?
It will:
A. print 0
B. cause a runtime exception
C. prints 3
D. print an empty line
TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘int’
The correct answer is B:
TypeError: unsupported operand type(s) for +: ‘int’ and ‘NoneType’
The correct answer is B. The program, when executed, will cause a runtime exception error.
1) for the print statement
2) because you cannot add and integer with a None type