#!/usr/bin/env python3 # vim: set sw=4 ts=4 et tw=80: import sys def histogram(data): top = max(max(data), 0) bottom = min(min(data), 0) i = top while i >= bottom: to_print = "" for elem in data: if i == 0: to_print += "-" elif (i > 0 and elem >= i) or \ (i < 0 and elem <= i): to_print += "#" else: to_print += " " print(to_print) i = i - 1 def main(): args = [int(x) for x in sys.argv[1:]] histogram(args) if __name__ == "__main__": main()