Difference between for loop and while loop in Python
Answer Posted / nashiinformaticssolutions
It is common practice to iterate through the items of different collection types, including List, Tuple, Set, and Dictionary, using the "for" loop. Developers employ a "for" loop in which the conditions are both the beginning and the conclusion. In contrast, the true looping feature found in all other programming languages is the "while" loop. Python while loops are used by programmers when they only have end conditions.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Print the length of each line in the file ‘file.txt’ not including any whitespaces at the end of the lines?
What are tuples in python?
What is the difference between lists and tuples?
Is there a benefit to using one over the other?
What are key words in python?
What is python private heap space?
Which web server is best for python?
Explain the synbtax to split a string in python?
Which all are the operating system that Python can run on?
Is python is easy?
How is fail over mechanism works in python?
What are the different uses of help() and dir() functions in python?
Explain the use of the split function in python?
how do I pass a variable by reference?
Why python is faster than java?