Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Create list with numbers between 2 values by

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 :: list to string 
Python :: how to create string in python 
Python :: initialize dictionary to zero in python 
Python :: python remove special characters from list 
Python :: python check if 3 values are equal 
Python :: else if in django template 
Python :: python name input 
Python :: get text selenium 
Python :: only get top 10 python dataframe 
Python :: create an array of n same value python 
Python :: django hash password 
Python :: matplotlib bar label 
Python :: pymongo [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate 
Python :: how to make a separate list of values from dictionaries in python 
Python :: how to skip next 5 iteration in python 
Python :: python 2 is no longer supported 
Python :: read from text file and append in list 
Python :: change string list to int list python 
Python :: python color input 
Python :: python get last element of list 
Python :: from array to tuple python 
Python :: random numbers python 
Python :: skip element in list comprehension 
Python :: python timer decorator 
Python :: batchnorm1d pytorch 
Python :: python reverse 2d list 
Python :: python set timezone of datetime.now 
Python :: flask-callable 
Python :: openpyxl load file 
Python :: how to play video in colab 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =