Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- count = 0
- category1 = 0
- category2 = 0
- category3 = 0
- category4 = 0
- ended = False
- while not ended:
- mark=input("Enter a mark: ")
- mark=int(mark)
- if mark == -1:
- ended=True
- elif mark >= 70 and mark <= 100:
- category4 += 1
- elif mark >= 40 and mark <= 69:
- category3 += 1
- elif mark >= 30 and mark <=39:
- category2 +=1
- elif mark >= 0 and mark <=29:
- category1 +=1
- else:
- print("Wrong number. Try again.")
- maxSize = max(category1,category2,category3,category4)
- for i in range(maxSize, 0, -1):
- currentLine = ""
- for j in range(0,5):
- if j == 0:
- currentLine += "{0:2}|".format(i)
- else:
- categoryAmount = 0
- if j == 1:
- categoryAmount = category1
- elif j == 2:
- categoryAmount = category2
- elif j == 3:
- categoryAmount = category3
- else:
- categoryAmount = category4
- sign = " "
- if categoryAmount >= i:
- sign = "■"
- currentLine += " {:^11}".format(sign)
- print(currentLine)
- print(" {0:^11} {1:^11} {2:^11} {3:^11}"
- .format("category1","category2","category3","category4"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement