Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Create list with numbers between 2 values

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 :: how to make a rect in pygame 
Python :: pandas get day names 
Python :: subprocess.check_output python 
Python :: python check if character is letter 
Python :: horizontal bar plot matplotlib 
Python :: two for loops in list comprehension 
Python :: axios django 
Python :: how to start a new django project 
Python :: python checking if something is equal to NaN 
Python :: seaborn pairplot 
Python :: how to find the last item of a list 
Python :: django date formatting 
Python :: full form of rom 
Python :: xor string python 
Python :: django month name from month number 
Python :: python 2 deprecated 
Python :: get hash python 
Python :: python substitute multiple letters 
Python :: multiprocessing queue python 
Python :: how explode by using two columns pandas 
Python :: roman to integer python 
Python :: convert a pdf folder to excell pandas 
Python :: python for loop with increment 
Python :: button onclick message box in python tkinter 
Python :: batchnormalization keras 
Python :: how to take input in python3 separated by space 
Python :: check integer number python 
Python :: python subprocess print stdout while process running 
Python :: openpyxl full tutorial 
Python :: pandas reemplazar nan por cero 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =