Python includes exercises 88
Title: 7 reads the number (1-50) integer values, each read a value, the program prints out the number of the value *.
Program Analysis: None.
Source Code:
#!/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 above example output is:
input a number: 9 ********* input a number: 5 ***** input a number: 6 ****** input a number: