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

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

Answered by Chantelle L. Python tutor

1257 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

What would you expect to be the output of the following code snippet: `a = [1, 2, 3]; b = a; b[1] = 4; print(a); print(b);`, and why?


Create a program that checks for syntactical errors in an email address.


Write a recursive function to return the nth Fibonacci number in Python


Write a basic program to output the lowest of 3 input numbers. (You may omit error checks on your inputs)


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo
Cookie Preferences