+ 2
How 6 is the output?
def f(a): x=a**2 y=0 while x>1: x-=1 y+=2 return y print (f(1)+f(2))
2 Respuestas
+ 4
Copy that prog and add lots of print
+ 3
If a=1 in f function while loop will executed 0 time ( because 1**2 =1 and 1 = 1). In case a = 2, 2**2 = 4, so loop executes 3 times and y will be 6.