Latest web development tutorials

Python incluye ejercicios 45

Python 100 Li Python 100 Li

Título: Estadística 1-100 suma.

Análisis del programa: Ninguno

Código fuente:

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

tmp = 0
for i in range(1,101):
    tmp += i
print 'The sum is %d' % tmp

La salida del ejemplo anterior es:

The sum is 5050

Python 100 Li Python 100 Li