Latest web development tutorials

Python incluye ejercicios 46

Python 100 Li Python 100 Li

Título: la búsqueda de plaza digital de entrada, a menos de 50 si la salida de cuadratura.

Análisis del programa: Ninguno

Código fuente:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

TRUE = 1
FALSE = 0
def SQ(x):
    return x * x
print '如果输入的数字小于 50,程序将停止运行。'
again = 1
while again:
    num = int(raw_input('Please input number'))
    print '运算结果为 %d' % (SQ(num))
    if num >= 50:
        again = TRUE
    else:
        again = FALSE

La salida del ejemplo anterior es:

如果输入的数字小于 50,程序将停止运行。
Please input number300
运算结果为 90000
Please input number12
运算结果为 144

Python 100 Li Python 100 Li