Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

create 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} ')
Comment

PREVIOUS NEXT
Code Example
Python :: list of numbers 
Python :: input and ouput array in python 
Python :: how to export DataFrame to CSV file 
Python :: how to make a list string in python 
Python :: heroku python version 
Python :: delete values with condition in numpy 
Python :: python square all numbers in list 
Python :: read csv and store in dictionary python 
Python :: python replace character in string 
Python :: isnull().mean() python 
Python :: converting decimal to hex in python 
Python :: how to convert fahrenheit to celsius in python 
Python :: json url to dataframe python 
Python :: sort dict by value python 3 
Python :: dropna in specific column pandas 
Python :: python class 
Python :: pip install qrcode python 
Python :: standardise columns python 
Python :: create dictionary from keys and values python 
Python :: get only every 2 rows pandas 
Python :: .text python 
Python :: pil crop image 
Python :: ban command in discord.py 
Python :: nn.dropout 
Python :: pygame how to find the full screen mode 
Python :: Python all versions lookup 
Python :: zscore python 
Python :: delete dictionary key python 
Python :: openpyxl fast tutorial 
Python :: change xlabel rotate in seaborn 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =