python_by_example/main.py
2023-11-22 11:54:37 -03:00

160 lines
3.7 KiB
Python
Executable File

#!/usr/bin/env python
from basic import basic
from trtl import trtl
from interm import interm
from tkgui import tkgui
from sqlite import sqlite
from final import final
from common.common import clear, user_input, opcs_default
def toc():
content="""\tContenido\n
1) Basicos 001-059
2) Turtle 060-068
3) Intermedios 069-123
4) Tkinter 124-138
5) SQLite 139-145
6) Finales 146-150
s) Salir
"""
print(content)
def basic_challenges():
content = """
1) Basicos 001-011
2) Basicos 012-019
3) Basicos 020-026
4) Basicos 027-034
5) Basicos 035-044
6) Basicos 045-051
7) Basicos 052-059
"""
select_ok = False
while not select_ok:
clear()
print(content)
opcs_default(1)
selection = user_input(7)
match selection:
case 1:
basic.challenges01()
case 2:
basic.challenges02()
case 3:
basic.challenges03()
case 4:
basic.challenges04()
case 5:
basic.challenges05()
case 6:
basic.challenges06()
case 7:
basic.challenges07()
case 'v':
return
case 's':
exit(0)
case _:
continue
def interm_challenges():
content = """
1) Interm 069-079
2) Interm 080-087
3) Interm 088-095
4) Interm 096-104
5) Interm 105-110
6) Interm 111-117
7) Interm 118-123
"""
select_ok = False
while not select_ok:
clear()
print(content)
opcs_default(1)
selection = user_input(7)
match selection:
case 1:
interm.challenges01()
case 2:
interm.challenges02()
case 3:
interm.challenges03()
case 4:
interm.challenges04()
case 5:
interm.challenges05()
case 6:
interm.challenges06()
case 7:
interm.challenges07()
case 'v':
return
case 's':
exit(0)
case _:
continue
def tkinter_challenges():
content = """
1) Tkinter 124-132
2) Tkinter 133-138
"""
select_ok = False
while not select_ok:
clear()
print(content)
opcs_default(1)
selection = user_input(2)
match selection:
case 1:
tkgui.challenges01()
case 2:
tkgui.challenges02()
pass
case 'v':
return
case 's':
exit(0)
case _:
continue
def main():
clear()
header = """
=======================================
\"Learning to Program in 150 Challenges\"
Python by example, Nichola Lacey
=======================================
programmed by devfzn@gmail.com
---------------------------------------\n"""
select_ok = False
while not select_ok:
clear()
print(header)
toc()
selection = user_input(6)
match selection:
case 1:
basic_challenges()
case 2:
trtl.challenges()
case 3:
interm_challenges()
case 4:
tkinter_challenges()
case 5:
sqlite.challenges()
case 6:
final.challenges()
case 's':
select_ok = True
exit(0)
case _:
select_ok = False
if __name__ == '__main__':
main()