Objective
Create a Python program organized as a reusable module: the functions are defined at the top and the main program only runs when the file is launched directly.
Instructions
- Define the function
square(n), which returnsnsquared. - Define the function
is_even(n), which returnsTrueifnis even. - Define the function
main(), which reads an integer and showsSquare: SandEven: E(TrueorFalse), each on one line. - At the end of the file call
main()insideif __name__ == "__main__":.
4
Square: 16
Even: True
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise