Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python Exercise Example 88

Python Exercise Example 88

Python 100 Examples Python 100 Examples

**Problem:** Read 7 integer values (1-50); each time a value is read, the program prints that many asterisks (*).

**Analysis:** None.

Example

#!/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

The output of the above example is:


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

Python 100 Examples Python 100 Examples