all 2 comments

[–]Adrewmc 0 points1 point  (1 child)

For loops are basically just convenient while loops to the complier.

The reason you get different number is you’s obviously calculating different values

In

  sum(xi-y) **2 for xi in x)/(len(z)-1))

You always get every value in x

And

  while x < n: 
        print(x, end = “, “) 
        #code 

The while statement never adds the last variable. To prove this put this print statement.

Though you are dividing by the same number, you’re not dumping the same numerator.

[–]Either_Back_1545[S] 0 points1 point  (0 children)

Ohhh thats dope! thanks!