Skip to content
Sign upLog in
← Back to Community

Rounding (in python)

Profile icon

I am trying to round 4 numbers in a list with the round() function, but it is not working. Lines 142 and 149 are where I am trying to round it (I have it in two places). My numbers are randomly changed to simulate the fluxuations in the market, but when they come out, they are decimals. I want to then change each number to not have a decimal, but just an interger.

Answered by Spacecraft [earned 5 cycles]
View Answer
Profile icon
Profile icon

I'm not sure exactly what is going on here, but it looks like you are not actually setting the variable with the round function.
Line 142-
IS: round(prices[i])
SHOULD BE: prices[i] = round(prices[i])

Line 150-
IS: round(i)
SHOULD BE: prices[i] = round(i) ??? Not exactly sure what you are doing here, but hopefully you get the idea. Calling the function all by itself doesn't do anything if it isn't assigned to a variable.

Profile icon

Thank you so much! It [email protected]

Profile icon

Python is the popular and latest programming language these days. There are the lots of people who really want to learn about and looking for the proessaywriting review help to fix the coding problems able to grab it there. Thanks for the tremendous work keep going with your excellent sharing