How would you write a while loop to print all even numbers from 1-10?

i = 2while i <= 10: print(i) i += 2

CL

Related Python Mentoring answers

All answers ▸

h


[Student query] Why do we import libraries/modules such as Numpy and Matplotlib into Python?


[Exam style] Python is an interpreted language. Explain what this means and how interpreted languages differ from compiled languages.


How can you take a list of numbers and add 3 to every number in the list using only one line of code?