-
Black Box and Glass Box Testing
With the below implementation, is the test set "n = 4 | n = -4 | n = 5" path complete?
def is_even(n):"""Returns True if a number is evenand False if not"""if n > 0 and n % 2 == 0:return Trueelif n < 0 and n % 2 == 0:return Trueelse:return False -
Errors
Below is a piece of code and an error shown when running it. What is the problem?
L = 3for i in range(len(L)):print(i)ERROR MESSAGE:File "C:/Users/Ana/.spyder2-py3/temp.py", line 2, infor i in range(len(L)):TypeError: object of type 'int' has no len() -
Exceptions
If the user enters "twenty" in the code below what does the program do?
try:n = int(input("How old are you? "))percent = round(n*100/80, 1)print("You've gone through", percent, "% of your life!")except ValueError:print("Oops, must enter a number.")except ZeroDivisionError:print("Division by zero.")except:print("Something went very wrong.")
With the above implementation, which value for n is incorrectly labeled by is_even?
If the user enters "0" in the code above what does the program do?
