September 2019
Beginner to intermediate
494 pages
13h
English
In this subsection, we will look into the process of writing a docstring for functions with the help of PyCharm. Let's get started:
import sysfrom math import sqrtdef prime_check(n: int) -> bool: # TODO: docstring goes here if n < 2: return False limit = int(sqrt(n)) + 1 for i in range(2, limit): if n % i == 0: return False # return False if a divisor is found return True # return True if no divisor is foundif __name__ == '__main__': input_ = input('Enter a number: ') # get user input # handle invalid ...Read now
Unlock full access