xxxxxxxxxx
def mean(numbers):
numbers.sort()
q = len(numbers) // 2
if len(numbers) % 2 !=0:
return numbers[q]
elif len(V) % 2 == 0:
return (numbers[q - 1] + numbers[q]) / 2
xxxxxxxxxx
import statistics
a = [1,2,3,4,5]
mean = statistics.mean(a)
#Similar for other values such as variance, standard deviation
xxxxxxxxxx
def avrg(values): # where values is a list of all values
return sum(values)/len(values)
xxxxxxxxxx
avreage_cost = cost
avg = sum(avreage)/len(avreage)
print("The average amout you spent is ", round(avg,2))
xxxxxxxxxx
import numpy as np
values=[1,10,100]
print(np.mean(values))
values=[1,10,100,np.nan]
print(np.nanmean(values))
confirm alert sweetalert2
xxxxxxxxxx
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'Deleted!',
'Your file has been deleted.',
'success'
)
}
})
xxxxxxxxxx
Swal.fire(
'Data Add Successfully!',
'You clicked the button!',
'success'
)
xxxxxxxxxx
Swal.fire(
'Good job!',
'You clicked the button!',
'failed'
)