Skip to content Skip to sidebar Skip to footer

TypeError: A Float Is Required

Can't post image, so: a[i]={(-1)^(i+1)*sin(x)*ln(x)}/{i^2*(i+1)!} The task: Need to find a1,a2,...,an. n is natural and it's given. That's the way I tried to do this: import math a

Solution 1:

Seems like you're using Python 3.x version. The result of an input call is a string taken from keyboard, which you pass to a math.sin(...) function. float(x) converts x to float but does not store the converted value anywhere, so change:

float(x)

to:

x = float(x)

to get right behaviour of your code.


Post a Comment for "TypeError: A Float Is Required"