Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

mean of a list python

import numpy as np
np.mean(list)
np.std(list)
Comment

list mean python

# Python program to get average of a list

def Average(lst): 
	return sum(lst) / len(lst) 

# Driver Code 
lst = [15, 9, 55, 41, 35, 20, 62, 49] 
average = Average(lst) 

# Printing average of the list 
print("Average of the list =", round(average, 2)) 

# Output:
# Average of the list = 35.75
Comment

python find the mean of a list

numbers = [3, 18, 2, 1, 70, 12, 36, 12, 78, 5, 6, 9]

import statistics

print(statistics.mean(numbers))
Comment

mean of a list python

l = [15, 18, 2, 36, 12, 78, 5, 6, 9]

# By using the built-in statistics library
import statistics
statistics.mean(l)  # 20.11111111111111

# By defining a custom function
def average(my_list):
  return sum(my_list) / len(my_list)
average(l) # 20.11111111111111
Comment

PREVIOUS NEXT
Code Example
Python :: python string cut substring 
Python :: python pip install 
Python :: how to hide command console python 
Python :: python telegram bot send image 
Python :: python 1 to 01 
Python :: how to import .csv file in python 
Python :: numpy create a matrix of certain value 
Python :: psyche asteroid 
Python :: python number divisible by two other numbers 
Python :: get os information python 
Python :: python delete duplicate lines in file 
Python :: pandas strips spaces in dataframe 
Python :: tkinter how to connect keyboard key to button 
Python :: python get dict values as list 
Python :: how to save unzipped files in python 
Python :: python tkinter frame title 
Python :: spread operator python 
Python :: python append element to array 
Python :: turtle write 
Python :: update print python 
Python :: while not equal python 
Python :: save dataframe to csv 
Python :: does np.random.randint have a seed 
Python :: pthon - progressbar 
Python :: taking string input from user in python with try except 
Python :: 2d array python3 
Python :: Concat and Append DFs Python 
Python :: memory used by python program 
Python :: correlation between two columns pandas 
Python :: plt change grid color 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =