python之根据数值打印对应数目*号

#coding:utf-8
values = []

print("Enter 10 integers")

for i in range(10):
    newValue = int(input("Enter integer %d: " % (i + 1)))
    values += [newValue]
    
print("%s %10s %10s" % ('Elemnt', 'value', 'Histogram'))

for i in range(len(values)):
    print("%7d %10d %s" % (i, values[i], "*" * values[i]))

 

END!

posted @ 2016-06-30 19:21  知_行  阅读(1005)  评论(0编辑  收藏  举报