Stefan Ram wrote:
Is this the best way to write a "loop and a half" in Python?
Is your goal brevity or clarity, or something else (for instance, what does the code written by the other members of your "team" look like--woudn't it be nice if it matched)?
Bill
x = 1 while x: x = int( input( "Number (enter 0 to terminate)? " )) if x: print( f'Square = { x**2 }' ) In a C-like language, one could write: while x = int( input( "Number (enter 0 to terminate)? " )) print( f'Square = { x**2 }' ) .
-- https://mail.python.org/mailman/listinfo/python-list