what is the output for the following lines of code

  1. for i in [0,2,3]:
    if i%2 == 0:
    print(“even”)
    elif i%2 !=0:
    print(“nil”)
    else:
    print(“odd”)

  2. If we execute the expression foo = ‘abc’ * 10 what is the result?

  3. x = “”
    while x != “xx”:
    x += “x”
    print(x)

  4. def f(u,y=)
    for I in range(u):
    y:append(i*i)
    Print(y)
    f(6)
    f(6, [4,1,5])
    f(6)

Hello, everyone, I need your kind solution and explanation on the above questions.

This feels suspiciously like homework. What have you go so far?

thanks for your kind response. I need an explanation to understand the syntax very well.

What do you already have? We aren’t a ‘do your homework’ service here.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.