python_by_example/main.py

150 lines
3.4 KiB
Python
Raw Normal View History

2023-11-09 17:45:00 -03:00
#!/usr/bin/env python
from basic import basic
2023-11-11 00:09:22 -03:00
from trtl import trtl
2023-11-11 14:50:26 -03:00
from interm import interm
2023-11-09 17:45:00 -03:00
from common.common import clear, user_input, opcs_default
def toc():
content="""\tContenido\n
1) Basicos 001-059
2023-11-11 00:09:22 -03:00
2) Turtle 060-068
2023-11-11 14:50:26 -03:00
3) Intermedios 069-123
2023-11-11 00:09:22 -03:00
4) Tkinter 124-138
5) SQLite 139-145
2023-11-09 17:45:00 -03:00
...
s) Salir
"""
print(content)
def basic_challenges():
content = """
2023-11-09 20:37:02 -03:00
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
2023-11-09 17:45:00 -03:00
"""
select_ok = False
while not select_ok:
clear()
print(content)
2023-11-11 00:09:22 -03:00
opcs_default(1)
2023-11-10 14:35:11 -03:00
selection = user_input(7)
2023-11-09 17:45:00 -03:00
match selection:
case 1:
basic.challenges01()
case 2:
basic.challenges02()
case 3:
basic.challenges03()
case 4:
basic.challenges04()
case 5:
2023-11-09 20:37:02 -03:00
basic.challenges05()
2023-11-09 17:45:00 -03:00
case 6:
2023-11-10 01:57:44 -03:00
basic.challenges06()
2023-11-09 17:45:00 -03:00
case 7:
2023-11-10 14:35:11 -03:00
basic.challenges07()
2023-11-09 17:45:00 -03:00
case 'v':
return
case 's':
exit(0)
case _:
continue
def interm_challenges():
content = """
2023-11-11 00:09:22 -03:00
1) Interm 069-079
2) Interm 080-087
3) Interm 088-095
2023-11-13 13:07:55 -03:00
4) Interm 096-104
2023-11-11 00:09:22 -03:00
5) Interm 105-110
6) Interm 111-117
7) Interm 118-123
2023-11-09 17:45:00 -03:00
"""
2023-11-11 14:50:26 -03:00
select_ok = False
while not select_ok:
clear()
print(content)
opcs_default(1)
2023-11-13 13:07:55 -03:00
selection = user_input(4)
2023-11-11 14:50:26 -03:00
match selection:
case 1:
interm.challenges01()
case 2:
2023-11-12 23:46:19 -03:00
interm.challenges02()
2023-11-11 14:50:26 -03:00
case 3:
2023-11-13 02:26:58 -03:00
interm.challenges03()
2023-11-11 14:50:26 -03:00
case 4:
2023-11-13 13:07:55 -03:00
interm.challenges04()
2023-11-11 14:50:26 -03:00
case 5:
#interm.challenges05()
pass
case 6:
#interm.challenges06()
pass
case 7:
#interm.challenges07()
pass
case 'v':
return
case 's':
exit(0)
case _:
continue
2023-11-09 17:45:00 -03:00
def tkinter_challenges():
content = """
1) Tkinter 124-132
2) Tkinter 133-138
"""
print(content)
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()
2023-11-11 00:09:22 -03:00
selection = user_input(10)
2023-11-09 17:45:00 -03:00
match selection:
case 1:
basic_challenges()
case 2:
2023-11-11 00:09:22 -03:00
trtl.challenges()
2023-11-09 17:45:00 -03:00
case 3:
2023-11-11 00:09:22 -03:00
interm_challenges()
2023-11-09 17:45:00 -03:00
case 4:
2023-11-11 00:09:22 -03:00
tkinter_challenges()
2023-11-09 17:45:00 -03:00
case 5:
pass
case 6:
pass
case 7:
pass
case 8:
pass
case 9:
pass
case 10:
pass
case 's':
select_ok = True
exit(0)
case _:
select_ok = False
if __name__ == '__main__':
main()