What is the difference between a for loop and a while loop?

A for loop will run the code a predetermined number of times, whereas a while loop will continue to execute the code until a predetermined condition is met.

MI
Answered by Molly I. Python tutor

1583 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Creating string from multiple strings(or characters)


Firstly, my question is not Python related, but maths A-level related. I don't know how to change that in my profile but I would like to only tutor maths GCSE and potentially A-level. My question: Integrate sin(x)^3 over x=0 and x=pi/2.


What is the difference between a for and a while loop?


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


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