Why the range is from 2 to x-1 instead x?


its not. we don’t want to include x in the range, to indicate this we write x-1. However, range() function doesn’t include its stop value, so we don’t have to write -1 within the range function call


A post was split to a new topic: Is_prime


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.