Problem:


度数分布

健康診断で生徒の身長を計測しました。身長のデータを入力とし、度数分布を作成して出力するプログラムを作成してください。度数分布の階級は 5 cm 刻みの 6 つの階級とし、度数は人数を *（半角アスタリスク）で表示します。ただし、その階級の度数（人数）が 0 の場合、階級の見出しのみを出力してください。

Input

入力は以下の形式で与えられます。

n
h1
h2
:
hn

1 行目に生徒の数 n (1 ≤ n ≤ 40)、2 行目以降に i 人目の身長を表す実数 hi (150.0 ≤ hi ≤ 190.0、小数第 1 位まで) がそれぞれ 1 行に与えられます。

Output

以下の形式で度数分布を表示してください。

1 行目 見出し「1:」につづいて 165.0 cm 未満の人数分の *
2 行目 見出し「2:」につづいて 165.0 cm 以上〜 170.0 cm未満の人数分の *
3 行目 見出し「3:」につづいて 170.0 cm 以上〜 175.0 cm未満の人数分の *
4 行目 見出し「4:」につづいて 175.0 cm 以上〜 180.0 cm未満の人数分の *
5 行目 見出し「5:」につづいて 180.0 cm 以上〜 185.0 cm未満の人数分の *
6 行目 見出し「6:」につづいて 185.0 cm 以上の人数分の *

Sample Input 1

4
180.3
168.2
165.5
175.3

Output for the Sample Input 1

1:
2:**
3:
4:*
5:*
6:

Sample Input 2

21
179.4
171.5
156.6
173.0
169.4
181.2
172.4
170.0
163.6
165.9
173.5
168.2
162.5
172.0
175.1
172.3
167.5
175.9
186.2
168.0
178.6

Output for the Sample Input 2

1:***
2:*****
3:*******
4:****
5:*
6:*



Sample input:
4
180.3
168.2
165.5
175.3


Sample output:
1:
2:**
3:
4:*
5:*
6:

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
[out1, out2, out3, out4, out5, out6] = [0 for i in range(6)] 
for i in range(n):
    k = float(raw_input())
    if k < 165.0: out1 += 1
    elif 165.0 <= k < 170.0: out2 += 1
    elif 170.0 <= k < 175.0: out3 += 1
    elif 175.0 <= k < 180.0: out4 += 1
    elif 180.0 <= k < 185.0: out5 += 1
    elif 185.0 >= k: out6 += 1

for j,k in zip([i for i in range(1,7)],[out1, out2, out3, out4, out5, out6]):
    print str(j) + ':' + str('*'*k)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
[out1, out2, out3, out4, out5, out6] = [0 for i in range(6)] 
for i in range(n):
    k = float(raw_input())
    if k < 165.0: out1 += 1
    elif 165.0 <= k < 170.0: out2 += 1
    elif 170.0 <= k < 175.0: out3 += 1
    elif 175.0 <= k < 180.0: out4 += 1
    elif 180.0 <= k < 185.0: out5 += 1
    elif 185.0 >= k: out6 += 1

for j,k in zip([i for i in range(1,7)],[out1, out2, out3, out4, out5, out6]):
    print str(j) + ':' + '*'*k

Submission status: Accepted

Solution code:
n=int(input())
x=[0 for i in range(6)]
for i in range(n):
  a=float(input())
  if a<165.0:
    x[0]+=1
  elif 165.0<=a<170.0:
    x[1]+=1
  elif 170.0<=a<175.0:
    x[2]+=1
  elif 175.0<=a<180.0:
    x[3]+=1
  elif 180.0<=a<185.0:
    x[4]+=1
  else:
    x[5]+=1
for i in range(6):
  print('{}:{}'.format(i+1,x[i]*'*'))

Submission status: Accepted

Solution code:
C = [0] * 6
for _ in [0] * int(raw_input()):
  a, b = map(int, raw_input().split('.'))
  C[max([0, (a-160)/5])] += 1
for i in range(6):
  print '%d:%s' %(i+1, '*'*C[i])

Submission status: Accepted

Solution code:
C = [0] * 6
for _ in [0] * int(raw_input()):
  a, b = map(int, raw_input().split('.'))
  if a<165: C[0]+=1
  else: C[(a-160)/5] += 1
for i in range(6):
  print '%d:%s' %(i+1, '*'*C[i])

Submission status: Accepted

Solution code:
C = [0] * 7
for _ in [0] * int(input()):
  a = int(input())
  if a<165: C[1]+=1
  elif a<170: C[2] += 1
  elif a<175: C[3] += 1
  elif a<180: C[4] += 1
  elif a<185: C[5] += 1
  else: C[6] += 1
for i in range(1,7):
  print '%d:%s' %(i, '*'*C[i])

Submission status: Accepted

Solution code:
n = int(raw_input())
[out1, out2, out3, out4, out5, out6] = [0 for i in range(6)] 
for i in range(n):
    k = float(raw_input())
    if k < 165.0: out1 += 1
    elif 165.0 <= k < 170.0: out2 += 1
    elif 170.0 <= k < 175.0: out3 += 1
    elif 175.0 <= k < 180.0: out4 += 1
    elif 180.0 <= k < 185.0: out5 += 1
    elif 185.0 <= k: out6 += 1

for j,k in zip([i for i in range(1,7)],[out1, out2, out3, out4, out5, out6]):
    print str(j) + ':' + '*'*k

Submission status: Accepted

Solution code:
dic = {}
for i in range(1,7):
    dic[str(i)+':'] = ''
    
for i in range(input()):
    c = float(raw_input())
    if c < 165.0:
        dic['1:'] = dic['1:']+'*'
    elif 165.0 <= c < 170.0:
        dic['2:'] = dic['2:']+'*'
    elif 170.0 <= c < 175.0:
        dic['3:'] = dic['3:']+'*'
    elif 175.0 <= c < 180.0:
        dic['4:'] = dic['4:']+'*'
    elif 180.0 <= c < 185.0:
        dic['5:'] = dic['5:']+'*'
    elif 185.0 <= c:
        dic['6:'] = dic['6:']+'*'

for k, v in sorted(dic.items(), key=lambda x: x[0]):
    print k+v

Submission status: Accepted

Solution code:
n = int(input())
ans = ["1:","2:","3:","4:","5:","6:"]
for i in range(n):
    num = float(input())
    if num < 165.0:
        ans[0] = ans[0] + "*"
    elif num < 170.0:
        ans[1] = ans[1] + "*"
    elif num < 175.0:
        ans[2] = ans[2] + "*"
    elif num < 180.0:
        ans[3] = ans[3] + "*"
    elif num < 185.0:
        ans[4] = ans[4] + "*"
    else:
        ans[5] = ans[5] + "*"
for k in range(len(ans)):
    print(ans[k])

Submission status: Accepted

Solution code:
h = [float(input()) for _ in range(int(input()))]
d = {"1": ":","2": ":","3": ":","4": ":","5": ":","6": ":"}
for v in h:
    if v < 165.0:
        d["1"] += "*"
    elif v >= 165.0 and v < 170.0:
        d["2"] += "*"
    elif v >= 170.0 and v < 175.0:
        d["3"] += "*"
    elif v >= 175.0 and v < 180.0:
        d["4"] += "*"
    elif v >= 180.0 and v < 185.0:
        d["5"] += "*"
    else:
        d["6"] += "*"

for k, v in sorted(d.items(), key=lambda x: int(x[0])):
    print(k+v)

Submission status: Accepted

Solution code:
a={0:0,1:0,2:0,3:0,4:0,5:0}
for _ in range(int(input())):
    b=int(float(input()))
    if b<165:b=160
    elif b>185:b=185
    a[b//5-32]+=1
for i in a:print('%d:'%(i+1)+'*'*a[i])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import math

N = int(input())

A = [0] * 6

for i in range(N):
    h = float(input())

    if h < 165.0:
        A[0] += 1
    elif h < 170.0:
        A[1] += 1
    elif h < 175.0:
        A[2] += 1
    elif h < 180.0:
        A[3] += 1
    elif h < 185.0:
        A[4] += 1
    else:
        A[5] += 1

for i, a in enumerate(A):
    s = "{}:{}".format(i+1, '*' * a)
    print(s)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""


"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    ranks = [0] * 6
    n = int(input())
    for _ in range(n):
        h = float(input())
        if h < 160.0:
            h = 160.0
        if h >= 190.0:
            h = 189.9
        pos = int((h - 160.0) / 5)
        ranks[pos] += 1

    for i, f in enumerate(ranks):
        print('{}:{}'.format(i+1, '*'*f))


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
# Aizu Problem 00136: Frequency Distribution of Height
#
import sys, math, os, copy

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input2.txt", "rt")


limits = {1: [0, 165], 2: [165, 170], 3: [170, 175], 4: [175, 180],
          5: [180, 185], 6: [185, 9999999]}

dist = {k: 0 for k in range(1, 7)}
N = int(input())
for _ in range(N):
    h = float(input())
    for k in range(1, 7):
        if h < limits[k][1]:
            dist[k] += 1
            break
for k in range(1, 7):
    print("%d:%s" % (k, '*' * dist[k]))

Submission status: Accepted

Solution code:
n = int(input())
data = {k: 0 for k in range(1, 7)}
for _ in range(n):
    tmp = float(input())
    if tmp < 165.0:
        data[1] += 1
    elif 165.0 <= tmp < 170.0:
        data[2] += 1
    elif 170.0 <= tmp < 175.0:
        data[3] += 1
    elif 175.0 <= tmp < 180.0:
        data[4] += 1
    elif 180.0 <= tmp < 185.0:
        data[5] += 1
    else:
        data[6] += 1

for k, v in data.items():
    print("{}:{}".format(k, v*"*"))

Submission status: Accepted

Solution code:
import os
import math

def main():
    lst = [0,0,0,0,0,0]
    for i in range(0, int(input())):
        temp = float(input())
        if temp < 165:
            lst[0] += 1
        elif temp < 170:
            lst[1] += 1
        elif temp < 175:
            lst[2] += 1
        elif temp < 180:
            lst[3] += 1
        elif temp < 185:
            lst[4] += 1
        else:
            lst[5] += 1
    for i in range(0,6):
        print("{}:".format(i+1), end="")
        for j in range(0,lst[i]):
            print("*", end = "")
        print()

main()

Submission status: Accepted

Solution code:
HEIGHT_BASE = [165, 170, 175, 180, 185, 1000]

distribution = [0, 0, 0, 0, 0, 0]

input_data = [float(input()) for lp in range(int(input()))]

for item in input_data:
    for index, base in enumerate(HEIGHT_BASE):
        if item < base:
            distribution[index] += 1
            break

for index in range(6):
    print(str(index + 1) + ":" + "*" * distribution[index])

Submission status: Accepted

Solution code:
n = int(input())
h = []
for i in range(n):
    h.append(float(input()))
temp = [165., 170., 175., 180., 185., 190.]
h.sort()
t = 0
ans = [0 for i in range(6)]
for i in h:
    while i >= temp[t]:
        t += 1
    ans[t] += 1
for i in range(6):
    print(str(i+1) + ':' + '*' * ans[i])

Submission status: Accepted

Solution code:
n = int(input())
h = [0 for i in range(6)]
for i in range(n):
    a = float(input())
    if(a < 165.0):
        h[0] += 1
    elif(165.0 <= a and a < 170.0):
        h[1] += 1
    elif(170.0 <= a and a < 175.0):
        h[2] += 1
    elif(175.0 <= a and a < 180.0):
        h[3] += 1
    elif(180.0 <= a and a < 185.0):
        h[4] += 1
    else:
        h[5] += 1

for i in range(len(h)):
    print(str(i + 1) + ":" + "*"*h[i])

Submission status: Accepted

Solution code:
import math

N = int(input())

data = [0 for i in range(6)]

for l in range(N):
    n = float(input())
    if n < 165.0:
        data[0] += 1
    elif n < 170.0:
        data[1] += 1
    elif n < 175.0:
        data[2] += 1
    elif n < 180.0:
        data[3] += 1
    elif n < 185.0:
        data[4] += 1
    else:
        data[5] += 1

for l in range(6):
    print(l+1, end="")
    print(":", end="")
    for i in range(data[l]):
        print("*", end="")
    print("")

Submission status: Accepted

Solution code:
from collections import Counter

cnt = Counter()
n = int(input())
for _ in range(n):
  h = float(input())
  if h < 165:
    cnt[1] += 1
  elif h < 170:
    cnt[2] += 1
  elif h < 175:
    cnt[3] += 1
  elif h < 180:
    cnt[4] += 1
  elif h < 185:
    cnt[5] += 1
  else:
    cnt[6] += 1

for k in (1, 2, 3, 4, 5, 6):
  print(k, "*" * cnt[k], sep=":")

Submission status: Accepted

Solution code:
# AOJ 0136: Frequency Distribution of Height
# Python3 2018.6.18 bal4u

freq = [0]*6

for i in range(int(input())):
	k = float(input())
	if   k < 165: freq[0] += 1
	elif k < 170: freq[1] += 1
	elif k < 175: freq[2] += 1
	elif k < 180: freq[3] += 1
	elif k < 185: freq[4] += 1
	else:         freq[5] += 1

for i in range(6):
	print(i+1, ':', '*'*freq[i], sep='')

Submission status: Accepted

Solution code:
ans=[0]*6
for i in range(int(input())):
  a=float(input())
  if a < 165.0:ans[0]+=1
  if a >= 165.0 and 170 > a :ans[1]+=1
  if a >= 170.0 and 175 > a :ans[2]+=1
  if a >= 175.0 and 180 > a :ans[3]+=1
  if a >= 180.0 and 185 > a :ans[4]+=1
  if a >= 185.0:ans[5]+=1
if __name__ == '__main__':
  for i in range(1,7):
    print "%d:%s"%(i,ans[i-1]*"*")

Submission status: Accepted

Solution code:
import sys
R = lambda:map(int,raw_input().split())

n = int(raw_input())
le = [0 for i in xrange(6)]
for i in xrange(n):
    num = float(raw_input())
    if num < 165: le[0] += 1
    elif 165 <= num < 170: le[1] += 1
    elif 170 <= num < 175: le[2] += 1
    elif 175 <= num < 180: le[3] += 1
    elif 180 <= num < 185: le[4] += 1
    else: le[5] += 1

for j in xrange(6):
   print "%d:%s" % (j+1, '*'*le[j])

Submission status: Accepted

Solution code:
dist = [0] * 6
for i in range(int(raw_input())):
    height = float(raw_input())
    if height < 165: dist[0] += 1
    elif height < 170: dist[1] += 1
    elif height < 175: dist[2] += 1
    elif height < 180: dist[3] += 1
    elif height < 185: dist[4] += 1
    else: dist[5] += 1
for i in range(6):
    print "%d:%s" % (i + 1, '*' * dist[i])

Submission status: Accepted

Solution code:
d=[0,0,0,0,0,0]
n=input()
for i in range(n):
    a=input()
    if 165.0>a:d[0]+=1
    elif 165.0<=a<170:d[1]+=1
    elif 170.0<=a<175.0:d[2]+=1
    elif 175.0<=a<180.0:d[3]+=1
    elif 180.0<=a<185.0:d[4]+=1
    else:d[5]+=1
a=["*"*i for i in d]
print "1:{}\n2:{}\n3:{}\n4:{}\n5:{}\n6:{}".format(a[0],a[1],a[2],a[3],a[4],a[5])

Submission status: Accepted

Solution code:
from bisect import bisect
T = [165.0,170.0,175.0,180.0,185.0]
c = [""]*6
for _ in xrange(input()):
    c[bisect(T,float(raw_input()))] += "*"
for i,a in zip(xrange(1,7),c):
    print "{}:{}".format(i,a)

Submission status: Accepted

Solution code:
n = input()
hei = [0]*7
for i in xrange(n):
    hei[(min(189, max(160, int(input())))-155)/5]+=1
for i in xrange(1,7):
    print str(i)+":"+"*"*hei[i]

Submission status: Accepted

Solution code:
histo = ["" for i in range(6)]
n = int(raw_input())
for i in range(n):
    h = float(raw_input())
    if   h < 165.0: histo[0] += "*"
    elif h < 170.0: histo[1] += "*"
    elif h < 175.0: histo[2] += "*"
    elif h < 180.0: histo[3] += "*"
    elif h < 185.0: histo[4] += "*"
    else          : histo[5] += "*"

for i in range(6):
    print "%d:%-s"%(i+1,histo[i])

Submission status: Accepted

Solution code:
f = ["" for i in range(6)]
n = int(raw_input())
for i in range(n):
    h = float(raw_input())
    if   h < 165.0: f[0] += "*"
    elif h < 170.0: f[1] += "*"
    elif h < 175.0: f[2] += "*"
    elif h < 180.0: f[3] += "*"
    elif h < 185.0: f[4] += "*"
    else          : f[5] += "*"

for i in range(6):
    print "%d:%-s"%(i+1,f[i])

Submission status: Accepted

Solution code:
def getIndex(n):
    i = 6
    if n < 165:
        i = 1
    elif n >= 165 and n < 170:
        i = 2
    elif n >= 170 and n < 175:
        i = 3
    elif n >= 175 and n < 180:
        i = 4
    elif n >= 180 and n < 185:
        i = 5
    return i

nums = [0] * 7
n = int(input())

for i in range(0,n):
    h = float(input())
    nums[getIndex(h)] += 1

for i in range(1,len(nums)):
    ans = str(i) + ":"
    for j in range(0,nums[i]):
        ans += "*"
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
Tall_list = [0] * 6
for i in range(n) :
    tall = float(input())
    if tall < 165 :
        Tall_list[0] += 1
    elif tall < 170 :
        Tall_list[1] += 1
    elif tall < 175 :
        Tall_list[2] += 1
    elif tall < 180 :
        Tall_list[3] += 1
    elif tall < 185 :
        Tall_list[4] += 1
    else :
        Tall_list[5] += 1

for i in range(6) :
    print(i+1, ":", sep = "", end = "")
    for j in range(Tall_list[i]) :
        print("*", end = "")
    print()

Submission status: Accepted

Solution code:
num_list = [0 for l in range(6)] #人数をカウントするためのリスト作成

#身長に合わせてリストの数をカウンタ変数にしカウントする
for _ in range(int(input())):
    num = float(input())
    if num < 165:num_list[0] += 1
    elif num < 170:num_list[1] += 1
    elif num < 175:num_list[2] += 1
    elif num < 180:num_list[3] += 1
    elif num < 185:num_list[4] += 1
    else:num_list[5] += 1
    
#出力
for j in range(1,7):
    print(str(j) + ":",end="")
    for k in range(num_list[j - 1]):
        print("*",end="")
    print()

Submission status: Accepted

Solution code:
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


SIZE = 6
table = [0]*SIZE
N = int(input())

for _ in range(N):
    tmp = float(input())

    if tmp < 165.0:
        table[0] += 1
    elif tmp < 170.0:
        table[1] += 1
    elif tmp < 175.0:
        table[2] += 1
    elif tmp < 180.0:
        table[3] += 1
    elif tmp < 185.0:
        table[4] += 1
    else:
        table[5] += 1

for i in range(1,7):
    print("%d:"%(i),end="")
    for k in range(table[i-1]):
        print("*",end="")
    print()

Submission status: Accepted

Solution code:
n=int(input())
b=[0,0,0,0,0,0]
for i in range(n):
    s=float(input())
    if s<165:
        b[0]+=1
    elif 165<=s<170:
        b[1]+=1
    elif 170<=s<175:
        b[2]+=1
    elif 175<=s<180:
        b[3]+=1
    elif 180<=s<185:
        b[4]+=1
    else:
        b[5]+=1
a=[print(str(i+1)+":"+"*"*b[i]) for i in range(len(b))]

Submission status: Accepted

Solution code:
L = [0] * 7

num = int(input())

for _ in range(num):
    h = float(input())
    if h < 165:
        L[1] += 1
    elif h < 170:
        L[2] += 1
    elif h < 175:
        L[3] += 1
    elif h < 180:
        L[4] += 1
    elif h < 185:
        L[5] += 1
    else:
        L[6] += 1

for i in range(1,7):
    print("{}:{}".format(i, "*" * L[i]))

Submission status: Accepted

Solution code:
n = int(input())
hist = [''] * 6

for _ in range(n):
  h = float(input())
  
  if h < 165:
    hist[0] += '*'
  elif 165 <= h < 170:
    hist[1] += "*"
  elif 170 <= h < 175:
    hist[2] += "*"
  elif 175 <= h < 180:
    hist[3] += "*"
  elif 180 <= h < 185:
    hist[4] += "*"
  else:
    hist[5] += "*"
  
for i in range(6):
  print(str(i+1) + ':' + hist[i])

Submission status: Accepted

Solution code:
n = int(input())
H=[]
for i in range(n):
  H.append(float(input()))
c1=0
c2=0
c3=0
c4=0
c5=0
c6=0

for j in range(n):
  if H[j]< 165.0:
    c1+=1
  elif 165.0<= H[j]<170.0:
    c2+=1
  elif 170.0<= H[j]<175.0:
    c3+=1
  elif 175.0<= H[j]<180.0:
    c4+=1
  elif 180.0<= H[j]<185.0:
    c5+=1    
  else:
    c6+=1
    

print("1:"+ c1*"*", sep="")
print("2:"+ c2*"*", sep="")
print("3:"+ c3*"*", sep="")
print("4:"+ c4*"*", sep="")
print("5:"+ c5*"*", sep="")
print("6:"+ c6*"*", sep="")

Submission status: Accepted

Solution code:
dic={1:0,2:0,3:0,4:0,5:0,6:0}
n=int(input())
for i in range(n):
    N=float(input())
    if N<165:dic[1] +=1
    elif 165<=N<170:dic[2] +=1
    elif 170<=N<175:dic[3] += 1
    elif 175<=N<180:dic[4] += 1
    elif 180<=N<185:dic[5] += 1
    else:dic[6] +=1
for i in range(6):print("%d:"%(i+1)+"*"*dic[i+1])

Submission status: Accepted

Solution code:
n=int(input())
l=[0]*6
for i in range(n):
    k=float(input())
    if k<165:l[0]=l[0]+1
    else:
        l[int((k-160)//5)]=l[int((k-160)//5)]+1
for i in range(6):
    m=f"{i+1}:"
    for j in range(l[i]):
        m+="*"
    print(m)

Submission status: Accepted

Solution code:
n = int(input())
hist = [""] * 6

for _ in range(n):
    h = float(input())

    if h < 165:
        hist[0] += "*"
    elif 165 <= h < 170:
        hist[1] += "*"
    elif 170 <= h < 175:
        hist[2] += "*"
    elif 175 <= h < 180:
        hist[3] += "*"
    elif 180 <= h < 185:
        hist[4] += "*"
    else:
        hist[5] += "*"

for i in range(6):
    print(str(i+1) + ":" + hist[i])

Submission status: Accepted

Solution code:
n = int(input())
data = {
    1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0
}

for _ in range(n):
    x = float(input())
    if x < 165.0:
        data[1] += 1
    elif 165.0 <= x < 170.0:
        data[2] += 1
    elif 170.0 <= x < 175.0:
        data[3] += 1
    elif 175.0 <= x < 180.0:
        data[4] += 1
    elif 180.0 <= x < 185.0:
        data[5] += 1
    elif 185.0 <= x:
        data[6] += 1

for key, val in data.items():
    a = '*' * val
    print('{}:{}'.format(key, a))

Submission status: Accepted

Solution code:
n = int(input())
height = [0 for i in range(6)]
for i in range(n):
    tmp = float(input())
    if tmp < 165:
        height[0]+=1
    elif tmp < 170:
        height[1]+=1
    elif tmp < 175:
        height[2]+=1
    elif tmp < 180:
        height[3]+=1
    elif tmp < 185:
        height[4]+=1
    else:
        height[5]+=1
for i, j in enumerate(height,1):
    print(str(i)+":"+"*"*j)

Submission status: Accepted

Solution code:
n = int(input())
s_1 = ''
s_2 = ''
s_3 = ''
s_4 = ''
s_5 = ''
s_6 = ''
for i in range(n):
    h = float(input())
    if h < 165.0:
        s_1 += '*'
    elif h < 170.0:
        s_2 += '*'
    elif h < 175.0:
        s_3 += '*'
    elif h < 180.0:
        s_4 += '*'
    elif h < 185.0:
        s_5 += '*'
    else:
        s_6 += '*'
print('1:'+s_1)
print('2:'+s_2)
print('3:'+s_3)
print('4:'+s_4)
print('5:'+s_5)
print('6:'+s_6)

Submission status: Accepted

Solution code:
n = input()
one = 0
two = 0
three = 0
four = 0
five = 0
six = 0
for i in range(n):
	tall = float(raw_input())
	if tall < 165.0:
		one +=1
	elif tall < 170.0:
		two += 1
	elif tall < 175.0:
		three += 1
	elif tall < 180.0:
		four += 1
	elif tall < 185.0:
		five += 1
	else:
		six += 1

print '1:' + '*' * one
print '2:' + '*' * two
print '3:' + '*' * three
print '4:' + '*' * four
print '5:' + '*' * five
print '6:' + '*' * six

Submission status: Runtime Error

Solution code:
histo = ["" for i in range(6)]
n = int(raw_input())
for i in range(n):
    h = float(raw_input())
    if h < 165.0:
        histo[0] += "*"
    elif h < 170.0:
        histo[1] += "*"
    elif h < 175.0:
        histo[2] += "*"
    elif h < 180.0:
        histo[3] += "*"
    elif h < 185.0:
        histo[4] += "*"
    else:
        histo[5] += "*"

for i in range(6):
    print "%d:%a"%(i,a[i])