Latest web development tutorials

Python incluye ejercicios 48

Python 100 Li Python 100 Li

Título: Las cifras comparativas.

Análisis del programa: Ninguno

Código fuente:

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

if __name__ == '__main__':
    i = 10
    j = 20
    if i > j:
        print '%d 大于 %d' % (i,j)
    elif i == j:
        print '%d 等于 %d' % (i,j)
    elif i < j:
        print '%d 小于 %d' % (i,j)
    else:
        print '未知'

La salida del ejemplo anterior es:

10 小于 20

Python 100 Li Python 100 Li