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 ▸

Write a program that can convert between celcius and farenheit temperature scales


How do I check if a number is prime using a python program?


Given a list of N numbers, use a single list comprehension to produce a new list that only contains those values that are: (a) even numbers, and (b) from elements in the original list that had even indices .


What is the difference between a FOR loop and WHILE loop and how do I write them?