About 11,700,000 results
Open links in new tab
  1. difference between loop iterations in python and Java or C

    Mar 28, 2014 · If you're using python 2.x, then the range call creates a full-fledged list in memory, holding all the numbers in the range. This would be like populating a LinkedList with the numbers in Java, and iterating over it. If you want to avoid the list, there's xrange.

  2. What are the different types of loops in C, Python, and Java?

    Mar 10, 2025 · The main types of loops in C, Python, and Java include the for loop, while loop, and do-while loop. These loops differ slightly in syntax and behavior but perform the same basic function of repeating code based on certain conditions.

  3. Difference between for loop in C and Python - GeeksforGeeks

    Dec 26, 2022 · However, there is a difference in working of c and python for loop, though both are used for iterations the working is different. For loop in C starts from the initialized value, and then it is checked for condition.

  4. What is Python's equivalent of Java's standard for-loop?

    Jul 2, 2013 · In a Java for loop, the step (the i += 2 part in your example) occurs at the end of the loop, just before it repeats. Translated to a while, your for loop would be equivalent to: if (n % i == 0) { return false; i += 2; Which in Python is similar: if n % i == 0: return False. i += 2.

  5. Why does the "for" loop work so different from other languages ... - Reddit

    Feb 16, 2022 · Both Java and C++ have for (type item: array) which is exactly the same as the Python version. Python simply lacks the more basic C-like construct, because it's simple (although not idiomatic) to mimic it by iterating over a range.

  6. Nested loop comparison in Python,Java and C - Stack Overflow

    Jul 23, 2010 · There are some Python-to-C tools that would lead to more C-like performance. @Carl: C by default has optimizations disabled. Java has them by default enabled. E.g. GCC makes such loops a nop already on -O1.

  7. LOOPS IN PROGRAMMING || C || C++ || JAVA || PYTHON.

    WHAT ARE LOOPS? Loops are the programming structure that repeats a set of instruction till a particular condition is met. Loop play a vital role in programming and there are numerous of programs which are completely based on loops like Sum, Factorial, Palindrome, Armstrong Number and many more.

  8. Loops in Programming - GeeksforGeeks

    May 17, 2024 · Loops, also known as iterative statements, are used when we need to execute a block of code repetitively. Loops in programming are control flow structures that enable the repeated execution of a set of instructions or code block as long as a specified condition is met.

  9. Iteration Statements in Programming - GeeksforGeeks

    Jun 3, 2024 · Iteration statements, commonly known as loops, are statements in programming used to execute part of code repeatedly based on condition or set of conditions. These constructs are important for performing repetitive tasks efficiently.

  10. 1.7. Loops and IterationJava for Python Programmers

    In Python the easiest way to write a definite loop is using the for loop in conjunction with the range function. For example: In Java we would write this as: Recall that the range function provides you with a wide variety of options for controlling the value of the loop variable.

  11. Some results have been removed
Refresh