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
        print(points)
    

    Expert Tally

     

    //Code Image

    //Sample output

    //Explanation

    Iteration 1:

    points = 0 ,

    iw =100 ,

    points = 0

    The adown conjuncture loop renew the loop

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

    points+=30

    print(points)

    then it recompense the case

    then it subjoins points+ = 30 instrument it subjoin the esteem as

     

    points = 0 + 30

    points = 30

    It displays the esteem 30 through the points variable.

    Iteration 2:

    points = 30 ,

    iw =100 ,

    points = 0

    The adown conjuncture loop renew the loop

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

    points+=30

    print(points)

    then it recompense the case

    then it subjoins points+ = 30 instrument it subjoin the esteem as

     

    points = 30 + 30

    points = 60

    It displays the esteem 60 through the points variable.

    Iteration 3:

    points = 60 ,

    iw =100 ,

    points = 0

    The adown conjuncture loop renew the loop

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

    points+=30

    print(points)

    then it recompense the case

    then it subjoins points+ = 30 instrument it subjoin the esteem as

     

    points = 60 + 30

    points = 90

    It displays the esteem 90 through the points variable.

    Iteration 3:

    points = 90 ,

    iw =100 ,

    points = 0

    The adown conjuncture loop renew the loop

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

    points+=30

    print(points)

    then it recompense the case

    then it subjoins points+ = 30 instrument it subjoin the esteem as

     

    points = 90 + 30

    points = 120

    It displays the esteem 120 through the points variable.

    Iteration 4:

    points = 120 ,

    iw =100 ,

    points = 0

    The adown conjuncture loop renew the loop

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

    points+=30

    print(points)

    then it referable recompense the case

    points<=100 is referable recompense the case , that instrument 120<=100 is False. It departure from the loop.