[hey, im trying to get an odd number that the number that follows it will be divisible by 243 wrote the followring but i dont get any result, please help :)
def answer3():
i = 1
while i < 100001:
if i % 2 == 1:
if (i + 1) % 243 == 0:
return i
i += 1
print(answer3())
What about
print(2 * 243 - 1)
It would be a shorter code.
Your while loop never exits because the line
i += 1
should be indented to become part of the while loop.
Without seeing the formatting, I suspect that your indentation is incorrect. Please use the python tabs to enclose your code.
(Jun-30-2020, 07:54 AM)Gribouillis Wrote: [ -> ]What about
print(2 * 243 - 1)
It would be a shorter code.
Your while loop never exits because the line i += 1
should be indented to become part of the while loop.
hey so how do you suggest putting it in the right indentation? thank you