About this document
Python While Loop Basics and Exercises by Nisha Poudel is a document available to read on EtoBox.
While loops continuously execute the code within the loop as long as a condition is true. This document provides an example of a while loop that decreases the variable "error" by dividing it by 4 on each iteration, printing the new value until error is less than or equal to 1. It then describes using a while loop to incrementally correct an offset from zero in an inverted pendulum simulation. The exercise has the reader initialize offset to -6 and add an if/else statement within the while loop to either dec
- Author
- Nisha Poudel
- Language
- EN