Latest web development tutorials

Python incluye ejercicios 88

Python 100 Li Python 100 Li

Título: 7 lee los valores enteros número (1-50), que cada uno lea un valor, el programa imprime el número del valor *.

Análisis del programa: Ninguno.

Código fuente:

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

if __name__ == '__main__':
    n = 1
    while n <= 7:
        a = int(raw_input('input a number:\n'))
        while a < 1 or a > 50:
            a = int(raw_input('input a number:\n'))
        print a * '*'
        n += 1

La salida del ejemplo anterior es:

input a number:
9
*********
input a number:
5
*****
input a number:
6
******
input a number:

Python 100 Li Python 100 Li