I am very new to programming, I am trying to code a function that prints the variance and mean based on a alpha I type in, or if I am not typing anything it defaults to 1.96. When I don't type anything it works fine, but when I type for example 1.625, it returns "TypeError: can't multiply sequence by non-int of type 'numpy.float64'"
Here is my code:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy import stats
def estimat(data):
var = np.var(data, ddof = 1)
forv = np.mean(data)
z = a*np.sqrt(var/len(data))
konf = {forv+z,forv-z}
return {"varians": var, "forventning,":forv, "konfidensintervall":konf}
x = stats.norm.rvs(0,1,100)
a = input("Enter your alpha: ") or 1.96
print (estimat(x))