Post

@PythonPr File "<string>", line 3
x* = x/2
^
SyntaxError: invalid syntax
Try x *= x/2
This muliplies x with half of x and saves is as new x.
Output would be 32
English

@PythonPr SyntaxError.
x* = x/2 isn’t valid Python syntax.
It should be:
x *= x/2
Tiny typo, instant crash 😅
English

@PythonPr x *= x/2 means:
x = x * (x/2)
Starting with x = 4:
First loop:
x = 4 * (4/2)
x = 8
Since 8 is still less than 10, the loop runs again.
Second loop:
x = 8 * (8/2)
x = 32
loop stops.
Output: 32
English

@PythonPr answer is 32
Iteration 1:
x *= x/2 => 4* 4/2 = 8
iteration 2: as x < 10
8*8/2 = 64/2 = 32
While loop condition fails
Final value 32
English













