python_by_example/interm/interm.py

223 lines
5.8 KiB
Python
Raw Permalink Normal View History

2023-11-11 14:50:26 -03:00
from . import interm01 as ex01
2023-11-12 23:46:19 -03:00
from . import interm02 as ex02
2023-11-13 02:26:58 -03:00
from . import interm03 as ex03
2023-11-13 13:07:55 -03:00
from . import interm04 as ex04
2023-11-14 01:26:06 -03:00
from . import interm05 as ex05
2023-11-14 14:52:47 -03:00
from . import interm06 as ex06
2023-11-14 23:29:30 -03:00
from . import interm07 as ex07
2023-11-11 14:50:26 -03:00
from common.common import (
print_challenges,
user_input,
run_func,
clear
)
def challenges01():
select_ok = False
while not select_ok:
clear()
i, ex1 = print_challenges(ex01.interm001)
selection = user_input(i)
match selection:
case 1:
run_func(ex1.countries)
case 2:
run_func(ex1.country_pos)
case 3:
run_func(ex1.two_sports)
case 4:
run_func(ex1.del_subject)
case 5:
run_func(ex1.fav_food)
case 6:
run_func(ex1.ten_colours)
case 7:
run_func(ex1.four_nums)
case 8:
run_func(ex1.three_names)
case 9:
run_func(ex1.uninvite)
case 10:
run_func(ex1.tv_titles)
case 11:
run_func(ex1.nums_list)
case 'v':
return
case 's':
select_ok = True
exit(0)
case _:
continue
2023-11-12 23:46:19 -03:00
def challenges02():
select_ok = False
while not select_ok:
clear()
i, ex2 = print_challenges(ex02.interm002)
selection = user_input(i)
match selection:
case 1:
run_func(ex2.len_name)
case 2:
run_func(ex2.fav_subj)
case 3:
run_func(ex2.poem)
case 4:
run_func(ex2.while_lower)
case 5:
run_func(ex2.postcode)
case 6:
run_func(ex2.vowels)
case 7:
run_func(ex2.passwrd)
case 8:
run_func(ex2.word_line)
case 'v':
return
case 's':
exit(0)
case _:
continue
2023-11-13 02:26:58 -03:00
def challenges03():
select_ok = False
while not select_ok:
clear()
i, ex3 = print_challenges(ex03.interm003)
selection = user_input(i)
match selection:
case 1:
run_func(ex3.int_array)
case 2:
run_func(ex3.rand_5)
case 3:
run_func(ex3.range_save)
case 4:
run_func(ex3.repeated)
case 5:
run_func(ex3.two_arrays)
case 6:
run_func(ex3.array_dels)
case 7:
run_func(ex3.sel_one)
case 8:
run_func(ex3.decim_array)
case 'v':
return
case 's':
exit(0)
case _:
continue
2023-11-13 13:07:55 -03:00
def challenges04():
select_ok = False
while not select_ok:
clear()
i, ex4 = print_challenges(ex04.interm004)
selection = user_input(i)
match selection:
case 1:
run_func(ex4.two_d)
case 2:
run_func(ex4.sel_row_col)
case 3:
run_func(ex4.sel_row)
case 4:
run_func(ex4.change_val)
case 5:
run_func(ex4.bidims_dict)
case 6:
run_func(ex4.bidict)
case 7:
run_func(ex4.user_data)
case 8:
run_func(ex4.dict_show_filter)
case 9:
run_func(ex4.dict_remove)
case 'v':
return
case 's':
exit(0)
case _:
continue
2023-11-14 01:26:06 -03:00
def challenges05():
select_ok = False
while not select_ok:
clear()
i, ex5 = print_challenges(ex05.interm005)
selection = user_input(i)
match selection:
case 1:
run_func(ex5.names_txt)
case 2:
run_func(ex5.names_txt)
case 3:
run_func(ex5.read_names)
case 4:
run_func(ex5.add_name)
case 5:
run_func(ex5.menu)
case 6:
run_func(ex5.names2)
case 'v':
return
case 's':
exit(0)
case _:
continue
2023-11-14 14:52:47 -03:00
def challenges06():
select_ok = False
while not select_ok:
clear()
i, ex6 = print_challenges(ex06.interm006)
selection = user_input(i)
match selection:
case 1:
run_func(ex6.books)
case 2:
run_func(ex6.add_book)
case 3:
run_func(ex6.add_n_books)
case 4:
run_func(ex6.find_by_date)
case 5:
run_func(ex6.show_data)
case 6:
run_func(ex6.data_edit)
case 7:
run_func(ex6.maths_quiz)
case 'v':
return
case 's':
exit(0)
case _:
continue
2023-11-14 23:29:30 -03:00
def challenges07():
select_ok = False
while not select_ok:
clear()
i, ex7 = print_challenges(ex07.interm007)
selection = user_input(i)
match selection:
case 1:
run_func(ex7.sub_118)
case 2:
run_func(ex7.sub_119)
case 3:
run_func(ex7.sub_120)
case 4:
run_func(ex7.sub_121)
case 5:
run_func(ex7.sub_122)
case 6:
run_func(ex7.sub_123)
case 'v':
return
case 's':
exit(0)
case _:
continue