📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    What is the output of the following part of the Python

    program?   c = 0 while (c
    A Hi Hi Hi Correct Answer Incorrect Answer
    B Hi Correct Answer Incorrect Answer
    C Hi Hi Correct Answer Incorrect Answer
    D None of these Correct Answer Incorrect Answer

    Solution

    Why this is correct (intended meaning): Interpreting the snippet as properly cased and indented Python: c = 0 while c <= 2 :     c = c + 1     print ( "Hi" ) The loop runs while c is 0,1,2 (three iterations). Each iteration increments c and prints Hi , so Hi prints three times on separate lines.

    Practice Next

    Relevant for Exams:

    ask-question