Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

list of 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} ')
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #list #numbers
ADD COMMENT
Topic
Name
3+8 =