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

875 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

What is the difference between a cycle "if" and "while"?


Write a simple Python program that asks a user to input their age and name and then return the text: "Hi my name is *NAME*, and I am *AGE* years old."


Generate an array of integers from 0 to 99 and split it into two smaller arrays. Each smaller array will contain half of the original.


Sort a given input of lowercase letters alphabetically


We're here to help

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

© MyTutorWeb Ltd 2013–2024

Terms & Conditions|Privacy Policy