About 399,000 results
Open links in new tab
  1. python - How can I generate a list of consecutive numbers

    Apr 10, 2015 · Depending on how you want the result, you can also print each number in a for loop: def numbers(): for i in range(int(input('How far do you wanna go? '))+1): print(i) So if the …

  2. How to Create a List of Consecutive Numbers in Python

    In Python, you can create a list of consecutive numbers using the range() function, list() constructor, or list comprehension. These methods allow you to generate sequences efficiently …

  3. How To find consecutive numbers in a list in Python? - SoftHints

    Apr 3, 2023 · To find consecutive numbers in a list in Python We can use different techniques. Below you can find 3 examples of grouping consecutive numbers in list/array in Python: My …

  4. PythonCheck if list contains consecutive - GeeksforGeeks

    Dec 19, 2024 · Checking if a list contains consecutive numbers in Python is useful in problems involving sequences, patterns, or data validation. In this article, we explore different methods …

  5. Python: Creating Lists of Consecutive Integers - Codingdeeply

    However, you can create a list of consecutive floating-point numbers using a combination of the numpy library’s arrange function and list comprehension. Here’s an example: import numpy as …

  6. Top Methods to Generate a List of Consecutive Numbers in Python

    Nov 24, 2024 · How Can I Generate a List of Consecutive Numbers in Python? Method 1: Utilizing the Built-in range Function; Method 2: Generating a List in Python 2; Practical Example: List …

  7. How can i print 'n' numbers in consecutive order in python?

    Sep 22, 2021 · How can I print 'n' number of series in a consecutive order? Basically, I want to print 'n' numbers in series without spaces. For example in my code, Output for n=5. But i want …

  8. Python: Generate groups of five consecutive numbers in a list

    Apr 19, 2025 · Write a Python program to create groups of k consecutive numbers from a list of numbers. Write a Python program to find all groups of three consecutive numbers that sum to …

  9. Grouping Consecutive Numbers in a List using Python 3

    Apr 15, 2024 · In this article, we will explore how to efficiently group consecutive numbers in a list using Python 3. Grouping consecutive numbers involves identifying sequences of numbers …

  10. how to loop through a list to find consecutive numbers?

    for n in new_text: # loop through every single number one by one for i in range(6): # for any 6 digit consecutive numbers in new_text if str(int(i + 5) - int(i)) = '5': consec_num = range(i, i + 5) if …

Refresh