I was trying out python -mtimeit
so I put python -mtimeit "n = 0; while n < 10: pass"
Then an invalid syntax error showed up. same with semicolon and for loop.
However, when I try semicolon and loop individually. Both worked fine.
python -c "for i in range(10): print(n)"
python -c "n = 1; n = 2; print(n)"
Why is this so and how can I test while loop in timeit? Thank you very much!
python -mtimeit -c "n = 1; n = 2; print(n)"
? – Liverwurst