This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
DSA/heasy.py

31 lines
609 B
Python
Raw Normal View History

2019-02-26 11:25:18 +00:00
#!/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()