Created
January 18, 2018 22:08
-
-
Save slendidev/dcdd44d7fd4d6b2713aea1c3ae022c53 to your computer and use it in GitHub Desktop.
Create boxes in python! Usage: python box_gen [lenght] [height] (--help)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from time import sleep | |
import sys | |
def gen_box(lenght, height): | |
box = "" | |
i = 0 | |
while i != height: | |
y = 0 | |
l = 0 | |
x = 0 | |
while y != lenght: | |
if y == lenght-1: | |
box = box + "╔══╗\n" | |
else: | |
box = box + "╔══╗" | |
y = y + 1 | |
while l != lenght: | |
if l == lenght-1: | |
box = box + "║ ║\n" | |
else: | |
box = box + "║ ║" | |
l = l + 1 | |
while x != lenght: | |
if x == lenght-1: | |
box = box + "╚══╝\n" | |
else: | |
box = box + "╚══╝" | |
x = x + 1 | |
i = i + 1 | |
return box | |
xandy = [] | |
for arg in sys.argv: | |
xandy.append(arg) | |
if "--help" in xandy: | |
print ("Use --help to get help with python "+xandy[0]+"\npython "+xandy[0]+" [lenght] [height]") | |
else: | |
print (gen_box(int(xandy[1]), int(xandy[2]))) #prima variabila este lungimea a doua este inaltimea!!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment