无法打印字符串和百分比

时间:2017-07-10 06:48:52

标签: python string python-2.7 python-3.x percentage

这是我的代码:

    from collections import Counter


    Value = (3, 19, 23, 27, 36, 10, 25, 29, 39, 41, 9, 16, 20, 31, 34, 2, 8, 9, 33, 37, 4, 21, 27, 28, 35, 2, 12, 21, 23, 38, 4, 5, 12, 16, 20, 1, 8, 21, 33, 38, 1, 9, 12, 18, 36, 5, 17, 20, 22, 25, 14, 21, 27, 31, 41, 11, 12, 23, 28, 41, 9, 22, 25, 34, 35, 5, 12, 19, 22, 39, 5, 13, 14, 17, 33, 4, 16, 26, 27, 37, 9, 18, 31, 34, 39, 9, 17, 33, 35, 40, 16, 20, 22, 37, 40, 2, 14, 19, 22, 32, 4, 5, 21, 29, 36, 2, 9, 22, 32, 35, 9, 13, 24, 36, 40, 3, 7, 9, 10, 28, 4, 20, 21, 23, 41, 12, 18, 26, 28, 34, 3, 23, 24, 27, 37, 4, 5, 26, 34, 36, 3, 5, 15, 25, 34, 4, 7, 9, 23, 32, 5, 7, 19, 29, 34, 2, 4, 25, 34, 38, 1, 4, 24, 32, 33, 20, 23, 31, 37, 40, 1, 20, 31, 36, 37, 1, 18, 30, 32, 41, 4, 8, 24, 26, 33, 3, 12, 13, 27, 34, 3, 6, 16, 24, 28, 10, 17, 20, 30, 32, 8, 10, 27, 28, 29, 6, 21, 23, 30, 32, 1, 22, 29, 33, 36, 1, 6, 9, 28, 30, 9, 12, 14, 19, 31, 1, 2, 10, 29, 37, 2, 7, 19, 20, 27, 7, 9, 30, 35, 37, 14, 23, 25, 29, 30, 4, 11, 19, 27, 32, 11, 15, 23, 26, 35, 14, 18, 22, 26, 28, 4, 17, 18, 23, 40, 10, 11, 16, 37, 39, 2, 12, 15, 27, 29, 3, 11, 20, 21, 26, 11, 17, 29, 31, 38, 9, 14, 15, 31, 32, 14, 25, 29, 35, 40, 1, 5, 8, 17, 27, 6, 14, 16, 18, 20, 13, 15, 29, 33, 35, 10, 18, 26, 38, 41, 13, 16, 20, 26, 27, 4, 12, 27, 32, 33, 7, 10, 26, 30, 31, 5, 7, 17, 37, 38, 3, 6, 10, 27, 38, 5, 15, 23, 33, 36, 11, 15, 31, 34, 38, 8, 9, 11, 15, 25, 6, 7, 21, 30, 33, 4, 17, 21, 34, 35, 3, 8, 16, 22, 34, 5, 23, 28, 31, 39, 7, 18, 24, 33, 40, 5, 24, 30, 38, 41, 3, 11, 25, 27, 37, 19, 26, 34, 36, 40, 20, 27, 30, 32, 38, 1, 16, 17, 26, 30, 6, 11, 14, 17, 28, 11, 18, 27, 33, 38, 4, 6, 7, 8, 25, 7, 28, 30, 35, 39, 20, 27, 31, 38, 41, 18, 27, 35, 37, 38, 17, 30, 32, 38, 39, 11, 12, 24, 33, 36, 1, 3, 8, 25, 34, 2, 3, 7, 15, 35, 8, 18, 19, 27, 32, 1, 3, 11, 15, 26, 15, 17, 21, 29, 36, 4, 16, 22, 24, 25, 3, 4, 19, 31, 35, 1, 15, 26, 33, 35, 8, 15, 29, 39, 40, 14, 19, 27, 32, 34, 8, 12, 22, 23, 28, 13, 28, 29, 31, 40, 1, 4, 16, 18, 26, 5, 8, 25, 31, 39, 5, 8, 16, 32, 33, 6, 11, 15, 21, 37, 19, 27, 32, 36, 37, 3, 10, 16, 25, 34, 5, 12, 18, 23, 37, 1, 11, 20, 30, 37, 11, 16, 29, 31, 39, 4, 13, 23, 28, 39, 9, 15, 25, 28, 32, 1, 7, 18, 20, 25, 8, 9, 25, 28, 33, 4, 10, 22, 26, 33, 4, 8, 9, 11, 27, 13, 21, 26, 30, 41, 1, 15, 24, 33, 39, 8, 11, 27, 34, 41, 12, 13, 14, 25, 34, 14, 16, 21, 31, 39, 4, 17, 18, 27, 37, 5, 10, 11, 15, 32, 6, 14, 27, 35, 36, 4, 14, 28, 34, 38, 1, 11, 14, 22, 30, 4, 5, 8, 23, 33, 3, 6, 14, 19, 32, 2, 19, 20, 23, 34, 3, 4, 14, 18, 29, 7, 10, 26, 37, 41, 12, 15, 19, 26, 34, 9, 15, 26, 27, 36, 2, 5, 22, 27, 34, 2, 13, 14, 21, 26, 8, 22, 23, 29, 37, 2, 18, 23, 24, 36, 3, 13, 19, 26, 37, 15, 17, 18, 24, 41, 5, 8, 12, 13, 34, 4, 9, 13, 28, 39, 6, 13, 21, 28, 29, 1, 7, 17, 29, 38, 11, 18, 25, 31, 39, 1, 2, 18, 26, 33, 10, 14, 16, 17, 34, 13, 15, 28, 29, 30, 2, 10, 12, 13, 41, 11, 13, 26, 27, 32, 3, 4, 30, 33, 40, 1, 7, 15, 19, 26, 4, 5, 14, 18, 34, 3, 5, 6, 33, 40, 10, 20, 23, 25, 39, 11, 13, 21, 36, 41, 18, 22, 30, 33, 36, 1, 7, 10, 12, 17, 9, 15, 23, 32, 38, 6, 8, 32, 33, 40, 14, 21, 31, 32, 36, 11, 23, 24, 33, 34, 8, 13, 17, 20, 36, 10, 16, 27, 30, 33, 1, 3, 4, 6, 23, 2, 4, 22, 32, 38, 2, 15, 18, 19, 21, 2, 4, 5, 20, 21, 21, 22, 29, 38, 40, 10, 27, 28, 32, 37, 5, 6, 8, 37, 40, 2, 9, 11, 40, 41, 10, 11, 17, 28, 34, 13, 15, 17, 18, 37, 9, 14, 21, 34, 35, 20, 22, 26, 33, 37, 3, 16, 18, 28, 31, 3, 24, 31, 33, 37, 1, 27, 28, 38, 40, 4, 20, 25, 33, 40, 7, 23, 25, 27, 32, 5, 6, 7, 13, 28, 3, 7, 17, 30, 36, 9, 18, 20, 37, 40, 1, 14, 21, 27, 37, 7, 18, 22, 23, 34, 10, 12, 25, 26, 40, 4, 9, 32, 34, 38, 2, 13, 16, 24, 33, 4, 18, 25, 30, 40, 7, 10, 27, 28, 33, 13, 16, 21, 27, 29, 10, 21, 32, 34, 35, 6, 16, 17, 22, 27, 16, 21, 24, 40, 41, 1, 2, 5, 9, 37, 1, 10, 17, 19, 37, 11, 20, 21, 30, 36, 1, 5, 22, 26, 30, 9, 12, 25, 34, 38, 2, 3, 6, 18, 28, 3, 6, 20, 22, 26, 3, 4, 9, 24, 27, 4, 7, 29, 32, 36, 4, 11, 18, 37, 40, 13, 15, 23, 34, 41, 17, 18, 34, 35, 36, 2, 14, 26, 33, 38, 1, 4, 22, 23, 32, 6, 13, 19, 33, 39, 8, 11, 12, 29, 40, 1, 4, 9, 11, 16, 5, 6, 13, 15, 28, 3, 10, 18, 19, 40, 1, 15, 25, 28, 38, 4, 19, 23, 26, 28, 1, 5, 11, 12, 36, 3, 14, 19, 23, 38, 1, 5, 9, 11, 35, 6, 10, 19, 23, 30, 14, 16, 23, 35, 40, 3, 5, 10, 15, 35, 4, 28, 33, 38, 41, 2, 17, 20, 22, 30, 7, 19, 20, 26, 31, 11, 13, 16, 17, 25, 3, 10, 16, 28, 39, 9, 18, 29, 37, 40, 2, 3, 25, 34, 41, 11, 28, 33, 38, 40, 4, 5, 9, 23, 41, 2, 9, 10, 22, 41, 1, 4, 9, 20, 27, 4, 7, 17, 24, 27, 3, 14, 15, 24, 29, 9, 13, 15, 27, 37, 17, 19, 26, 30, 34, 12, 16, 19, 21, 41, 1, 16, 24, 29, 39, 8, 21, 23, 25, 32, 2, 3, 22, 24, 40, 13, 15, 17, 28, 33, 1, 6, 19, 38, 41, 7, 17, 18, 21, 26, 3, 8, 21, 30, 35, 2, 24, 29, 33, 38, 7, 17, 18, 31, 36, 24, 31, 33, 38, 39, 21, 24, 27, 35, 41, 5, 9, 17, 23, 40, 17, 22, 29, 32, 34, 13, 14, 25, 36, 39, 2, 10, 22, 30, 32, 2, 16, 23, 28, 38, 5, 27, 30, 36, 41, 8, 23, 26, 29, 38, 6, 11, 22, 37, 38, 9, 26, 30, 35, 36, 10, 19, 29, 32, 40, 6, 11, 26, 27, 40, 1, 16, 21, 30, 33, 13, 21, 22, 33, 34, 5, 13, 23, 26, 37, 2, 11, 21, 24, 37, 4, 5, 20, 31, 34, 1, 20, 22, 27, 33, 1, 6, 11, 12, 14, 5, 10, 11, 36, 40, 5, 15, 36, 38, 39, 3, 6, 9, 17, 28, 13, 21, 24, 26, 37, 6, 10, 14, 17, 37, 5, 18, 23, 36, 38, 11, 13, 28, 36, 38, 5, 8, 17, 29, 41, 2, 12, 14, 27, 39, 4, 11, 20, 21, 39, 2, 6, 14, 31, 38, 2, 25, 26, 32, 33, 4, 10, 26, 32, 37, 5, 13, 14, 32, 41, 1, 4, 20, 21, 27, 2, 7, 14, 32, 34, 9, 12, 23, 24, 29, 9, 19, 22, 30, 33, 7, 13, 19, 35, 41, 1, 18, 19, 21, 24, 15, 18, 29, 31, 33, 14, 15, 16, 29, 35, 5, 16, 21, 33, 36, 12, 17, 23, 32, 34, 17, 20, 23, 33, 40, 5, 9, 24, 30, 34, 9, 14, 21, 26, 28, 1, 7, 19, 21, 24, 1, 5, 22, 33, 37, 1, 5, 17, 23, 29, 3, 11, 17, 24, 30, 7, 12, 18, 22, 34, 5, 7, 13, 21, 38, 9, 24, 32, 40, 41, 3, 17, 26, 33, 38, 5, 6, 7, 14, 30, 8, 19, 20, 28, 30, 4, 15, 26, 29, 32, 5, 7, 25, 28, 35, 10, 23, 35, 37, 41, 3, 11, 17, 19, 41, 4, 24, 25, 29, 34, 8, 22, 25, 27, 33, 2, 16, 20, 30, 31, 14, 19, 20, 33, 35, 15, 16, 17, 20, 38, 14, 23, 28, 29, 34, 7, 21, 26, 29, 36, 8, 9, 10, 25, 30, 12, 17, 26, 28, 36, 6, 10, 11, 20, 40, 7, 8, 21, 40, 41, 9, 15, 23, 33, 36, 1, 9, 27, 35, 36, 9, 13, 17, 18, 41, 12, 13, 24, 25, 29, 16, 21, 23, 36, 39, 6, 9, 19, 26, 28, 11, 27, 30, 35, 37, 3, 6, 23, 34, 38, 9, 14, 19, 24, 35, 5, 6, 20, 33, 41, 9, 13, 33, 37, 38, 9, 13, 24, 25, 36, 11, 15, 20, 36, 38, 6, 19, 24, 25, 37, 8, 12, 27, 33, 34, 9, 12, 18, 28, 36, 12, 17, 29, 34, 40, 1, 2, 10, 24, 34, 7, 25, 31, 36, 39, 1, 6, 7, 21, 28, 4, 5, 6, 18, 39, 22, 24, 26, 29, 36, 12, 23, 30, 31, 39, 28, 34, 35, 37, 38, 4, 8, 11, 22, 25, 5, 10, 23, 33, 40, 9, 19, 21, 34, 38, 6, 8, 9, 19, 35, 16, 32, 33, 34, 37, 1, 3, 6, 12, 15, 4, 29, 30, 39, 40, 16, 21, 24, 32, 36, 8, 19, 25, 30, 34, 10, 18, 24, 25, 39, 20, 24, 27, 28, 38, 12, 16, 18, 20, 31, 1, 11, 13, 19, 36, 20, 22, 25, 34, 38, 2, 10, 17, 27, 35, 4, 6, 8, 26, 40, 9, 12, 21, 28, 30, 19, 21, 26, 28, 37, 2, 4, 5, 32, 36, 15, 22, 25, 31, 41, 7, 13, 16, 29, 39, 10, 21, 23, 25, 37, 18, 22, 30, 35, 38, 10, 12, 13, 18, 39, 14, 17, 20, 30, 36, 21, 24, 25, 29, 35, 4, 7, 22, 33, 36, 3, 7, 10, 23, 37, 8, 9, 14, 25, 31, 7, 11, 30, 38, 40, 12, 13, 18, 26, 40, 2, 12, 22, 26, 36, 2, 19, 20, 23, 24, 1, 5, 16, 17, 27, 8, 17, 22, 35, 38, 1, 3, 19, 36, 38, 1, 12, 29, 35, 38, 2, 3, 27, 39, 41, 7, 11, 26, 35, 36, 14, 16, 18, 31, 35, 17, 24, 35, 38, 41, 3, 11, 27, 31, 37, 3, 25, 26, 29, 32, 8, 17, 19, 30, 33, 3, 18, 28, 31, 32, 1, 9, 13, 25, 36, 4, 6, 8, 17, 29, 7, 11, 24, 32, 33, 2, 7, 20, 26, 41, 5, 7, 14, 28, 38, 3, 8, 9, 21, 26, 5, 11, 25, 40, 41, 10, 13, 14, 29, 34, 3, 5, 15, 31, 37, 16, 24, 27, 31, 34, 4, 13, 16, 27, 40, 24, 26, 27, 32, 39, 10, 11, 12, 15, 23, 15, 31, 34, 36, 38, 5, 9, 21, 29, 35, 9, 13, 17, 22, 40, 13, 22, 28, 36, 39, 5, 16, 17, 19, 30, 13, 18, 25, 26, 38, 1, 5, 9, 27, 28, 3, 5, 19, 37, 39, 10, 13, 24, 32, 40, 3, 7, 8, 17, 24, 1, 10, 11, 12, 20, 4, 11, 15, 19, 23, 17, 26, 30, 38, 39, 6, 7, 10, 31, 41, 18, 21, 24, 32, 39, 4, 8, 12, 17, 24, 3, 4, 7, 23, 38, 11, 17, 23, 29, 34, 1, 10, 25, 30, 32, 2, 18, 20, 24, 27, 16, 24, 27, 31, 38, 1, 13, 17, 18, 36, 6, 8, 13, 20, 24, 5, 13, 16, 25, 29, 7, 13, 32, 33, 34, 15, 19, 26, 31, 35, 5, 9, 14, 21, 26, 1, 10, 16, 20, 31, 1, 6, 25, 33, 35, 3, 13, 14, 17, 30, 2, 5, 9, 38, 39, 22, 24, 27, 35, 36, 10, 18, 20, 27, 36, 5, 7, 20, 33, 35, 3, 8, 13, 21, 37, 13, 19, 22, 25, 39, 3, 14, 21, 23, 38, 15, 20, 30, 32, 35, 8, 9, 12, 24, 32, 10, 25, 35, 36, 37, 1, 11, 14, 18, 36, 7, 9, 25, 31, 38, 4, 5, 6, 16, 34, 5, 8, 9, 14, 28, 12, 17, 20, 23, 33, 1, 4, 8, 20, 25, 1, 8, 15, 27, 34, 10, 14, 15, 18, 23, 3, 18, 29, 31, 33, 6, 10, 16, 18, 21, 1, 4, 11, 14, 25, 7, 11, 19, 28, 37, 8, 13, 22, 28, 33, 10, 11, 14, 20, 37, 13, 15, 17, 19, 36, 10, 22, 26, 33, 36, 10, 15, 18, 19, 35, 8, 9, 20, 31, 33, 3, 8, 18, 31, 34, 2, 14, 24, 27, 31, 9, 11, 12, 15, 22, 13, 14, 15, 37, 39, 3, 4, 7, 27, 34, 6, 14, 24, 30, 38, 2, 3, 19, 21, 30, 5, 6, 15, 31, 32, 1, 6, 24, 26, 30, 9, 11, 25, 29, 30, 1, 16, 22, 30, 34, 1, 2, 12, 19, 34, 4, 10, 13, 20, 31, 18, 28, 33, 35, 39, 22, 23, 25, 27, 36, 1, 7, 28, 33, 34, 1, 12, 14, 32, 39, 16, 25, 28, 30, 32, 12, 19, 28, 31, 39, 12, 19, 25, 27, 32, 8, 14, 20, 31, 38, 10, 19, 21, 23, 32, 2, 3, 24, 30, 36, 3, 11, 22, 26, 39, 4, 13, 29, 33, 37, 9, 22, 30, 36, 39, 2, 8, 9, 33, 34, 2, 5, 15, 23, 28, 11, 23, 26, 29, 31, 10, 13, 15, 29, 34, 13, 18, 21, 22, 32, 4, 5, 7, 20, 24, 1, 15, 17, 29, 38, 2, 7, 20, 35, 38, 26, 33, 36, 37, 38, 3, 5, 14, 24, 39, 7, 8, 9, 24, 28, 8, 18, 29, 36, 37, 7, 10, 21, 25, 29, 3, 8, 26, 35, 36, 1, 21, 22, 24, 36, 5, 7, 19, 33, 37, 8, 22, 29, 30, 37, 5, 7, 14, 17, 25, 11, 22, 26, 33, 38, 7, 19, 20, 27, 34, 11, 18, 19, 30, 37, 5, 11, 14, 34, 38, 6, 9, 23, 29, 39, 2, 16, 22, 24, 37, 1, 8, 9, 29, 35, 15, 18, 20, 23, 28, 10, 14, 26, 30, 37, 3, 4, 6, 30, 36, 2, 5, 8, 18, 27, 5, 9, 21, 35, 37, 6, 8, 14, 22, 38, 21, 22, 27, 29, 37, 3, 4, 11, 34, 38, 7, 12, 17, 21, 32, 4, 8, 15, 26, 38, 6, 8, 23, 33, 35, 7, 19, 27, 37, 39, 4, 10, 24, 25, 38, 3, 5, 21, 36, 37, 6, 20, 27, 30, 34, 10, 14, 19, 21, 29, 13, 15, 30, 36, 37, 2, 15, 17, 31, 32, 8, 17, 34, 36, 37, 1, 11, 26, 29, 35, 10, 16, 17, 35, 36, 3, 17, 22, 29, 32, 7, 9, 10, 18, 38, 1, 5, 15, 18, 24, 9, 11, 12, 14, 35, 7, 10, 28, 29, 34, 10, 21, 24, 26, 38, 7, 22, 26, 34, 39, 1, 8, 10, 25, 31, 2, 3, 9, 18, 28, 5, 10, 24, 32, 33, 2, 8, 13, 14, 37, 3, 11, 15, 33, 35, 11, 17, 23, 24, 28, 10, 14, 20, 35, 37, 1, 19, 24, 26, 38, 20, 30, 32, 36, 39, 6, 24, 28, 35, 38, 3, 9, 10, 19, 28, 18, 22, 25, 31, 33, 3, 6, 8, 20, 21, 7, 16, 19, 21, 39, 10, 19, 27, 31, 36, 13, 21, 26, 29, 37, 14, 15, 21, 24, 25, 5, 10, 17, 21, 29, 3, 12, 25, 26, 32, 12, 14, 21, 34, 36, 5, 9, 14, 15, 38, 2, 27, 28, 30, 39, 5, 9, 11, 18, 38, 7, 15, 27, 30, 38, 13, 20, 24, 27, 35, 14, 15, 19, 20, 22, 4, 10, 13, 16, 19, 1, 2, 16, 35, 38, 6, 10, 20, 27, 34, 5, 6, 11, 21, 34, 6, 15, 28, 30, 36, 2, 5, 26, 28, 33, 14, 19, 21, 23, 33, 9, 10, 20, 22, 30, 1, 2, 13, 29, 34, 1, 6, 13, 17, 18, 3, 8, 11, 21, 28, 4, 7, 10, 16, 22, 3, 5, 6, 15, 22, 22, 24, 32, 35, 38, 14, 18, 26, 27, 28, 14, 20, 24, 26, 35, 4, 24, 26, 33, 37, 2, 14, 16, 25, 29, 1, 3, 24, 26, 36, 8, 20, 30, 31, 36, 6, 9, 17, 24, 35, 14, 18, 27, 35, 39, 5, 15, 19, 37, 38, 4, 6, 11, 18, 26, 18, 21, 22, 26, 32, 3, 7, 19, 20, 21, 3, 5, 16, 21, 33, 6, 14, 20, 22, 35, 6, 11, 13, 25, 28, 8, 13, 16, 38, 39, 19, 20, 24, 27, 29, 5, 14, 22, 31, 38, 18, 20, 22, 32, 36, 16, 19, 25, 34, 39, 4, 16, 19, 33, 38, 19, 22, 29, 33, 39, 11, 22, 26, 30, 32, 5, 6, 25, 27, 36, 5, 20, 32, 37, 38, 6, 13, 31, 35, 39, 2, 6, 22, 37, 39, 8, 22, 27, 34, 35, 3, 10, 21, 24, 29, 7, 21, 24, 30, 35, 14, 16, 21, 36, 38, 5, 10, 25, 30, 33, 3, 5, 9, 17, 23, 2, 8, 26, 34, 38, 1, 7, 23, 31, 38, 1, 10, 16, 22, 38, 5, 8, 9, 18, 27, 7, 13, 22, 25, 34, 4, 6, 11, 30, 33, 16, 19, 20, 21, 39, 11, 19, 21, 31, 36, 2, 3, 6, 12, 24, 3, 12, 16, 20, 37, 11, 18, 27, 33, 39, 7, 21, 24, 27, 30, 15, 16, 18, 21, 31, 5, 10, 22, 25, 26, 11, 16, 18, 29, 35, 1, 9, 25, 31, 32, 6, 7, 10, 23, 31, 5, 22, 28, 29, 37, 15, 18, 19, 24, 39, 4, 9, 12, 25, 32, 5, 7, 30, 31, 37, 2, 4, 9, 31, 39, 8, 10, 15, 31, 39, 2, 9, 22, 24, 30, 6, 11, 21, 28, 29, 14, 19, 20, 32, 33, 12, 13, 15, 20, 33, 1, 2, 19, 22, 37, 2, 12, 30, 36, 39, 2, 3, 5, 7, 28, 2, 25, 28, 32, 33, 8, 16, 19, 25, 28, 19, 30, 31, 36, 39, 4, 12, 23, 26, 36, 10, 11, 21, 27, 29, 1, 2, 5, 8, 26, 1, 12, 16, 18, 25, 15, 20, 21, 24, 34, 7, 12, 19, 31, 32, 12, 17, 19, 26, 32, 9, 18, 23, 29, 36, 12, 16, 30, 37, 38, 1, 11, 18, 28, 31, 17, 23, 28, 31, 35, 7, 18, 23, 32, 33, 4, 13, 15, 35, 37, 3, 22, 24, 30, 34, 7, 9, 28, 30, 37, 5, 12, 24, 34, 39, 2, 4, 9, 10, 11, 1, 8, 15, 18, 20, 12, 15, 22, 23, 34, 6, 8, 14, 32, 33, 1, 7, 15, 22, 24, 9, 15, 16, 18, 38, 13, 17, 22, 28, 31, 12, 19, 22, 34, 35, 2, 7, 10, 15, 34, 13, 22, 25, 31, 37, 1, 16, 27, 30, 31, 12, 24, 28, 30, 32, 14, 17, 21, 30, 38, 2, 6, 12, 17, 27, 1, 2, 8, 18, 39, 6, 10, 12, 21, 28, 10, 20, 22, 29, 31, 1, 5, 12, 22, 23, 5, 7, 8, 21, 26, 4, 9, 14, 21, 24, 6, 31, 32, 34, 39, 7, 17, 24, 33, 34, 3, 16, 22, 24, 36, 1, 12, 20, 31, 35, 1, 2, 28, 34, 38, 5, 21, 27, 30, 36, 8, 10, 14, 31, 32, 1, 3, 16, 26, 35, 2, 4, 26, 30, 35, 2, 6, 24, 31, 36, 5, 11, 12, 15, 37, 2, 15, 16, 17, 20, 8, 10, 16, 38, 39, 2, 12, 14, 16, 39, 15, 17, 27, 31, 38, 1, 3, 16, 32, 35, 6, 14, 16, 23, 30, 12, 22, 31, 34, 37, 3, 10, 12, 22, 39, 4, 20, 28, 38, 39, 2, 7, 18, 35, 38, 6, 7, 10, 16, 31, 2, 7, 13, 34, 38, 17, 18, 24, 26, 29, 11, 17, 21, 26, 35, 2, 3, 12, 29, 31, 13, 15, 20, 25, 38, 15, 22, 30, 34, 39, 18, 22, 35, 37, 39, 3, 13, 14, 35, 37, 1, 5, 30, 31, 32, 6, 7, 12, 28, 34, 1, 3, 16, 23, 32, 1, 7, 8, 13, 22, 1, 4, 11, 20, 36, 6, 14, 27, 28, 29, 11, 14, 24, 25, 38, 1, 12, 26, 28, 29, 1, 6, 8, 22, 37, 5, 11, 22, 35, 37, 3, 7, 11, 15, 34, 4, 7, 22, 31, 33, 2, 7, 11, 19, 29, 18, 19, 21, 22, 25, 13, 17, 18, 19, 34, 1, 20, 24, 30, 38, 11, 13, 14, 35, 36, 3, 11, 28, 31, 34, 2, 6, 11, 27, 36, 1, 9, 11, 16, 25, 15, 16, 20, 26, 38, 4, 6, 31, 34, 36, 8, 14, 19, 23, 31, 11, 22, 23, 28, 39, 2, 16, 19, 36, 38, 8, 12, 33, 36, 37, 3, 11, 21, 30, 39, 3, 8, 9, 14, 29, 7, 9, 20, 21, 37, 8, 13, 14, 30, 35, 3, 11, 26, 37, 38, 2, 8, 15, 33, 34, 2, 9, 14, 17, 26, 2, 6, 15, 34, 35, 1, 7, 23, 24, 37, 5, 7, 10, 26, 30, 8, 10, 11, 22, 33, 5, 8, 20, 30, 33, 11, 15, 21, 28, 39, 15, 16, 17, 32, 33, 17, 23, 28, 29, 39, 4, 7, 14, 18, 39, 8, 17, 27, 35, 37, 5, 7, 18, 21, 37, 4, 17, 18, 25, 31, 20, 26, 28, 31, 35, 5, 11, 14, 19, 23, 4, 7, 17, 27, 30, 6, 26, 27, 33, 35, 22, 25, 35, 36, 38, 4, 13, 15, 23, 26, 7, 9, 28, 32, 39, 14, 22, 25, 35, 37, 10, 23, 25, 35, 38, 5, 16, 17, 20, 21, 6, 10, 27, 28, 35, 2, 9, 20, 31, 37, 1, 19, 26, 31, 36, 3, 12, 24, 27, 29, 10, 17, 18, 31, 37, 3, 13, 17, 26, 32, 2, 7, 19, 25, 31, 2, 8, 19, 23, 27, 9, 16, 28, 34, 35, 1, 12, 33, 35, 39, 11, 15, 24, 32, 36, 4, 8, 12, 13, 35, 8, 14, 18, 22, 28, 1, 20, 22, 31, 32, 2, 8, 16, 17, 35, 1, 10, 16, 20, 25, 6, 18, 23, 33, 38, 5, 10, 21, 22, 30, 13, 17, 18, 19, 35, 4, 10, 12, 20, 37, 20, 22, 24, 26, 32, 18, 26, 28, 30, 36, 1, 2, 21, 25, 33, 3, 4, 9, 16, 35, 5, 12, 14, 28, 29, 2, 10, 17, 21, 38, 1, 9, 11, 28, 34, 2, 33, 35, 37, 38, 2, 6, 10, 35, 38, 4, 13, 16, 19, 35, 4, 7, 9, 12, 15, 4, 7, 21, 30, 32, 6, 13, 22, 30, 32, 2, 9, 13, 18, 33, 3, 10, 29, 37, 38, 1, 13, 23, 27, 32, 14, 15, 17, 24, 27, 8, 10, 14, 26, 31, 5, 15, 17, 31, 35, 12, 27, 31, 33, 36, 9, 12, 13, 15, 38, 13, 16, 27, 29, 32, 8, 14, 20, 24, 26, 12, 19, 23, 24, 33, 2, 9, 14, 16, 19, 9, 24, 31, 38, 39, 13, 22, 25, 26, 35, 10, 14, 17, 24, 36, 8, 11, 16, 17, 32, 1, 11, 27, 28, 31, 15, 23, 34, 35, 36, 1, 7, 14, 17, 35, 1, 24, 36, 37, 39, 9, 13, 16, 23, 36, 12, 13, 23, 24, 37, 1, 7, 13, 31, 33, 8, 12, 16, 27, 28, 6, 13, 28, 29, 30, 9, 10, 22, 23, 39, 1, 3, 5, 27, 35, 6, 13, 16, 34, 39, 14, 23, 25, 34, 37, 9, 17, 18, 36, 37, 11, 16, 24, 30, 36, 9, 19, 22, 26, 34, 11, 20, 22, 26, 29, 5, 24, 28, 29, 32, 10, 23, 25, 30, 33, 6, 8, 22, 31, 33, 1, 8, 10, 23, 38, 5, 9, 12, 32, 33, 5, 29, 31, 33, 35, 1, 4, 19, 23, 37, 24, 29, 30, 32, 36, 5, 12, 13, 23, 33, 1, 17, 18, 25, 26, 6, 9, 20, 33, 39, 3, 25, 30, 34, 39, 1, 5, 11, 14, 26, 4, 12, 13, 31, 35, 19, 20, 23, 24, 36, 1, 2, 6, 24, 34, 15, 32, 35, 36, 37, 1, 8, 14, 25, 38, 5, 8, 21, 23, 34, 1, 4, 10, 34, 39, 6, 7, 24, 36, 37, 6, 8, 22, 26, 38, 11, 17, 24, 27, 35, 12, 13, 16, 21, 29, 17, 18, 19, 28, 38, 23, 25, 31, 32, 39, 22, 24, 30, 31, 37, 3, 17, 21, 27, 31, 4, 24, 27, 28, 33, 13, 16, 26, 27, 31, 6, 22, 24, 34, 39, 20, 27, 30, 35, 37, 1, 4, 7, 15, 26, 8, 14, 16, 32, 34, 5, 23, 27, 37, 38, 4, 7, 20, 29, 35, 2, 11, 18, 25, 36, 2, 4, 5, 6, 10, 8, 11, 21, 25, 31, 5, 12, 23, 24, 27, 16, 18, 19, 28, 39, 1, 11, 13, 18, 39, 4, 10, 12, 28, 30, 9, 13, 25, 26, 30, 9, 11, 16, 20, 38, 4, 7, 18, 33, 39, 4, 11, 17, 31, 37, 15, 31, 34, 36, 38, 9, 11, 29, 34, 37, 4, 12, 21, 23, 31, 11, 12, 13, 31, 38, 12, 18, 31, 33, 39, 5, 9, 14, 16, 30, 7, 9, 11, 17, 30, 2, 5, 7, 14, 22, 22, 24, 28, 29, 31, 1, 10, 20, 21, 32, 12, 29, 31, 32, 33, 8, 13, 20, 30, 33, 5, 6, 13, 23, 28, 6, 7, 18, 22, 25, 14, 18, 19, 22, 35, 4, 9, 11, 26, 31, 1, 21, 23, 24, 36, 12, 25, 26, 29, 34, 3, 11, 13, 20, 26, 12, 14, 23, 26, 33, 13, 22, 24, 29, 37, 1, 16, 17, 22, 29, 2, 12, 17, 32, 34, 2, 10, 21, 25, 29, 8, 25, 26, 34, 39, 2, 28, 31, 33, 34, 7, 11, 17, 18, 21, 3, 6, 8, 12, 37, 8, 10, 14, 17, 35, 20, 21, 25, 26, 38, 15, 19, 22, 23, 37, 9, 12, 15, 20, 25, 6, 9, 18, 23, 31, 19, 20, 27, 36, 38, 1, 5, 12, 28, 37, 1, 3, 6, 24, 25, 14, 23, 26, 32, 39, 8, 24, 29, 35, 36, 18, 21, 32, 36, 37)

    V = Counter(Value)
    print(V)

    #For 'x' amount of number sets (from spreadsheet).
    #List Size(Ex. 917) do 917x5
    myInt = 4585
    #Divide for percentage
    percentdiv = [x / myInt for x in Value]
    #Times new value by 100 and format 2 decimal places to get percentage
    for i in percentdiv:
        Percentage = ("%{:.2f}".format(i * 100))
        for x in Value:
            print (x, Percentage,)

我正在试图弄清楚如何让python3打印出类似的东西:

    1 = %0.34, 2 = %0.21, 3 = %0.03
    4 = %0.22, 5 = %0.13, 6 = %0.01

但出于某种原因,我得到了:

    1 %0.07
    3 %0.07
    8 %0.07
    25 %0.07
    34 %0.07
    2 %0.07
    3 %0.07
    7 %0.07
    15 %0.07
    35 %0.07
    8 %0.07
    18 %0.07
    19 %0.07
    27 %0.07
    32 %0.07
    1 %0.07

我也注意到这些数字正在自行循环。 我喜欢Counter我喜欢的格式,但我需要的百分比不仅仅是次数。有人可以帮忙吗?

2 个答案:

答案 0 :(得分:2)

我认为您需要值列表中每个值的计数百分比。如果我错了请更正

for x,i in zip(Value,percentdiv):
    print("{}={:.2f}".format(x,i*100),end='')

答案 1 :(得分:0)

默认情况下,print函数最后会有\n,所以它应该是,

import sys

for i in percentdiv:
    Percentage = ("%{:.2f}".format(i * 100))
    for x in Value:
       sys.stdout.write(x, Percentage,)
 sys.stdout.write("\n")

here代码复制