Python Exercise Example46
# Python2.x Python Exercise Instance 46
[ Python 100 Examples](#)
**Question:** Find the square of the input number, and exit if the square is less than 50.
**Program Analysis:** None
Program source code:
## Instance
#!/usr/bin/python# -*- coding: UTF-8 -*-TRUE = 1 FALSE = 0 def SQ(x): return x * x print('If the input number is less than 50, the program will stop running.')again = 1 while again: num = int(input('Please enter a number:'))print('The operation result is: %d' % (SQ(num)))if SQ(num)>= 50: again = TRUE else: again = FALSE
The output of the above instance is:
If the input number is less than 50, the program will stop running.Please enter a number:12The operation result is: 144Please enter a number: 14. The operation result is: 196Please enter a number: 1. The operation result is: 1
[![Image 4: Python 100 Examples](
YouTip