Trying to obtain an RMS of a sequence of values from user input, and need to square all the values individually using POW function.
Hello,
I am trying to obtain an RMS of a sequence of values from user input and the first step is that all the values will need to be squared, but I keep getting an error whilst trying to compile the numbers to be squared (using the POW function). I am trying to complete this inside a tkinter GUI.
def enter():
entered_RMS=(entry_RMS.get())
result_RMS = entered_RMS.split(' ')
# Cast each element as an integer
for i in range(len(result_RMS)):
result_RMS[i] = int (result_RMS[i])
#square each number
SQR_RMS=pow(result_RMS,2)
# Add all the elements together
RMS_total = sum(SQR_RMS)
#Find the mean by dividing by how many numbers entered
mean= float (RMS_total/ len (SQR_RMS))
#Find the mean by dividing by how many numbers entered
mean= float (RMS_total/ len (SQR_RMS))
label_RMS.configure(text=str(square)+ ' is the RMS')
The error is keep getting is
TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int'
From my understanding, it is due to trying to take use RMS_total as an int and it does not work in the POW function.
you mean something like this: