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

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

CL
Answered by Chantelle L. Python tutor

1339 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

What is the difference between using range() and a list of values?


Why are negative indexes used?


Define a function that takes in the age of the user and adds it to an output sentence such as "You are ..... old".


Ask the user for a number and output the smallest divisor, bigger than one, for the inputted number. Output "Prime" if the number is a prime number.


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–2025

Terms & Conditions|Privacy Policy
Cookie Preferences