- 2

What is different between "While loop" and " For loop" in python.

26th Feb 2022, 3:12 PM
Thet Paing Htun
Thet Paing Htun - avatar
5 ответов
+ 6
Thet Paing Htun , since you have not started any tutorial in sololearn, it would be a good idea to start learning python now. both requested loops are described in the tutorial, and there are also exercises to get familiar with this topic. happy coding!
26th Feb 2022, 8:22 PM
Lothar
Lothar - avatar
+ 3
for loop is when you know how many iterations. While loop is when you don't
26th Feb 2022, 3:17 PM
Slick
Slick - avatar
+ 2
for loop is: "FOR this many times, do that" while loop is: "WHILE this, do that" they're used for different cases and usually come down to preference. in C, the statements: while (1) {} AND for (;;;) {} create infinite loops
28th Feb 2022, 2:56 PM
Slick
Slick - avatar
+ 2
For loop allows a programmer to execute a sequence of statements several times, While loop allows a programmer to repeat a single statement or a group of statements for the TRUE condition.
28th Feb 2022, 10:40 PM
Vaibhav
Vaibhav - avatar