31 lines
609 B
Python
31 lines
609 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
import sys
|
||
|
|
||
|
def histogram(A):
|
||
|
m = min(A)
|
||
|
|
||
|
for e in A:
|
||
|
negative = e < 0
|
||
|
|
||
|
if negative:
|
||
|
for _ in range(m,e):
|
||
|
print(" ", end="")
|
||
|
for _ in range(e,0):
|
||
|
print("#", end="")
|
||
|
print("|")
|
||
|
else:
|
||
|
for _ in range(m,0):
|
||
|
print(" ", end="")
|
||
|
print("|", end="")
|
||
|
for _ in range(0,e):
|
||
|
print("#", end="")
|
||
|
print("")
|
||
|
|
||
|
def main():
|
||
|
args = [int(x) for x in sys.argv[1:]]
|
||
|
histogram(args)
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|