Created
November 21, 2021 12:39
-
-
Save X-88/8c0510f453003f17bccd5de60d58751b to your computer and use it in GitHub Desktop.
Create Simple Table Using Ascii Character
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
from os import system | |
""" | |
Writed by: Zephio | |
Create Simple Table | |
Lang: Python 3.xx | |
""" | |
brd = u'\u2593' | |
spr = '=' * 34 | |
cno = 'No ' | |
cnm = 'Nama ' | |
ckls = 'Kelas' | |
lnm = [] | |
lkls = [] | |
def reset(): | |
system('sleep 2') | |
system('clear') | |
def idt(): | |
while True: | |
system('clear') | |
inm = input('Nama: ') | |
ikls = input('Kelas: ') | |
if (len(inm) < 3) or (len(inm) > 10) or (len(ikls) < 1): | |
print(spr + '\nWarning.\nNama Min 3, Max 10/Kelas Belum diisi!...\n' + spr) | |
reset() | |
return idt() | |
else: | |
lnm.append(inm) | |
lkls.append(ikls) | |
key = input(spr + '\nTambahkan Data?\ny = ya\nl = Lihat Data\nSembarang Tombol = Main Menu\n>>> ').lower() | |
if key == 'y': | |
idt() | |
elif key == 'l': | |
gdt() | |
else: | |
main() | |
def gdt(): | |
system('clear') | |
data = dict(zip(lnm, lkls)) | |
print(brd * 25) | |
print(brd, cno, brd, cnm , brd, ckls, brd) | |
print(brd * 25) | |
for i, j in enumerate(data): | |
print(brd, format('%03d' % (i + 1)), brd, j + " " * (len(cnm) - len(j)), brd, data[j], " " * (len(ckls) - len(data[j]) - 1), brd) | |
print(brd * 25) | |
system('sleep 5') | |
main() | |
def main(): | |
system('clear') | |
while True: | |
opsi = input('t = Tambah Data\nl = Lihat Data\nSembarang Tombol untuk Keluar\n>>> ') | |
if opsi == 't': | |
idt() | |
elif opsi == 'l': | |
gdt() | |
else: | |
exit(0) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment