0

What is for loop? (Python)

What is for loop for? How do I use it? "for ___ in ___:" How do I know what to put in the first blank?

29th Oct 2021, 8:03 AM
Joan
2 odpowiedzi
+ 1
Hi Joan Please specify which language so we may direct you to a relevant tutorial. Essentially, a for loop will iterate a preset number of times, and process the code / statement that is nested within the loop. Unfortunately, the previous statement does not help if you don't have a basic understanding of for loop
29th Oct 2021, 8:45 AM
Rik Wittkopp
Rik Wittkopp - avatar
0
name: "solo" for i in name: Print(i) It is a simple example of how for loop works. You don't have to declare 'i' , it's just used for iteration. For more info: https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_for_loops.asp
29th Oct 2021, 8:26 AM
Mosi B.
Mosi B. - avatar