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 ▸

What is the difference between a float and an integer variable type?


Write a recursive function to find the factorial of a number n.


Which four data types are used in Python? Can you give an example of each?


Explain how you would write a python program that takes a rectangle and a point in a 2D space as command-line arguments and checks if they intersect.