Hello folks.
I’m working with Hayden Klok and Yoni Nazarathy’s book “Statistics With Julia” and the Listing 1.10 dont work.
the error is:
Warning: ‘getindex(o::PyObject, s::Symbol)’ is deprecated in favor of dot overloading (‘getproperty’) so elements should now be accessed as e.g. ‘o.s’ instead of ‘o[:s]’.
• caller - top-level scope at none:0
Core none:0
I’ve tried several ways to solve, but I haven’t been successful. How do you solve this?
the code:
using PyPlot
function hailLength(x,Int64)
n=0
while x != 1
if x % 2 == 0
x = Int(x/2)
else
x = 3x +1
end
n += 1
end
return n
end
lengths = [hailLength(x0) for x0 in 2:10^7]
plt[:hist](lengths, 1000, density=“true”)
xlabel(“Length”)
ylabel(“Frequency”);