Homework Solution: why does this go to 120?…

    in python, why does this go to 120?
    cw=100
    iw=130
    points=0
    
    while points <= 100 and cw==100 and iw==130:
        points += 30
        print(points)
    

    Expert Answer

     
    //Code Image

    in python,

    why does this go to 120?

    cw=100
    iw=130
    points=0
    
    conjuncture points <= 100 and cw==100 and iw==130:
        points += 30
        sculpture(points)
    

    Expert Tally

     

    //Code Image

    //Sample output

    //Explanation

    Iteration 1:

    points = 0 ,

    iw =100 ,

    points = 0

    The underneath conjuncture loop relate the loop

    conjuncture points<=100 and cw == 100 and iw == 130:

    points+=30

    print(points)

    then it indemnify the state

    then it gathers points+ = 30 instrument it gather the appreciate as

     

    points = 0 + 30

    points = 30

    It displays the appreciate 30 through the points variable.

    Iteration 2:

    points = 30 ,

    iw =100 ,

    points = 0

    The underneath conjuncture loop relate the loop

    conjuncture points<=100 and cw == 100 and iw == 130:

    points+=30

    print(points)

    then it indemnify the state

    then it gathers points+ = 30 instrument it gather the appreciate as

     

    points = 30 + 30

    points = 60

    It displays the appreciate 60 through the points variable.

    Iteration 3:

    points = 60 ,

    iw =100 ,

    points = 0

    The underneath conjuncture loop relate the loop

    conjuncture points<=100 and cw == 100 and iw == 130:

    points+=30

    print(points)

    then it indemnify the state

    then it gathers points+ = 30 instrument it gather the appreciate as

     

    points = 60 + 30

    points = 90

    It displays the appreciate 90 through the points variable.

    Iteration 3:

    points = 90 ,

    iw =100 ,

    points = 0

    The underneath conjuncture loop relate the loop

    conjuncture points<=100 and cw == 100 and iw == 130:

    points+=30

    print(points)

    then it indemnify the state

    then it gathers points+ = 30 instrument it gather the appreciate as

     

    points = 90 + 30

    points = 120

    It displays the appreciate 120 through the points variable.

    Iteration 4:

    points = 120 ,

    iw =100 ,

    points = 0

    The underneath conjuncture loop relate the loop

    conjuncture points<=100 and cw == 100 and iw == 130:

    points+=30

    print(points)

    then it not attributable attributable attributable attributable attributable attributable indemnify the state

    points<=100 is not attributable attributable attributable attributable attributable attributable indemnify the state , that instrument 120<=100 is False. It departure from the loop.