Jun-08-2023, 10:30 AM
It took me a lot of tries before I was able to figure out the problem, and I was stunned. When building my genealogy website, I display 100 entries per page, but I don't want final pages with only a small handful. If there remain 101 entries I'd rather display 51 on one page and 50 on the next. It should have been simple with
However, it makes things worse. It takes the first line and instead of z = 50.5 it says z = 50 and the next line doesn't help. The program puts 50 lines on one page, 50 on the next and then builds a page with one lone entry. I had to work around and say
I don't recall this happening before in the years I've been coding in Python.
What is the way to say I absolutely want a decimal answer to remainder / 2 and also not a string variable because I need to do more math with it ?
1 2 |
z = (remainder / 2 ) z = int (z + 0.6 ) |
1 2 |
if remainder % 2 = = 1 : z = z + 1 |
What is the way to say I absolutely want a decimal answer to remainder / 2 and also not a string variable because I need to do more math with it ?