Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

generate list of consecutive numbers

import numpy as np

Vi = 0 # Initial value
Vf= 10 # Final Value

## Two ways (A and B)

#  A) list (E_l ): 
''' Use range function in Python 3.x range is a iterator you need to convert it to a list''';
l = list(range(Vi, Vf))

# B)list incremented by N: 
N = 0.5 # Increment by 0.5
l_by = np.arange(Vi, Vf, N).tolist()

# Print 

print(f' list = {l}')
print(f' list = {l_by}, by: {N} ')
Comment

PREVIOUS NEXT
Code Example
Python :: input and ouput array in python 
Python :: python tkinter fenstergröße 
Python :: django custom save method 
Python :: extend a list python 
Python :: import os 
Python :: override python print for class 
Python :: pandas select 2nd row 
Python :: rotate image in pygame 
Python :: if elseif in single line python 
Python :: numpy arrauy to df 
Python :: turn df to dict 
Python :: splitting a number into digits python 
Python :: reportlab page size a4 
Python :: how to connect wifi using python 
Python :: data frame list value change to string 
Python :: creating a list in python 
Python :: append path to sys jupyter notebook 
Python :: np.polyfit plot 
Python :: how to extract integers from string python 
Python :: df to csv 
Python :: python array from 1 to n 
Python :: hstack in numpy 
Python :: python remove first element from list 
Python :: python multiline string 
Python :: how to use elif in python 
Python :: how to connect an ml model to a web application 
Python :: how to merge two dictionaries 
Python :: How to do train test split in keras Imagedatagenerator 
Python :: how to select a file in python 
Python :: lowercase all text in a column 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =