moving files
1
q1/01dec/test.Ltxt
Normal file
Before Width: | Height: | Size: 256 KiB After Width: | Height: | Size: 256 KiB |
Before Width: | Height: | Size: 321 KiB After Width: | Height: | Size: 321 KiB |
Before Width: | Height: | Size: 261 KiB After Width: | Height: | Size: 261 KiB |
Before Width: | Height: | Size: 790 KiB After Width: | Height: | Size: 790 KiB |
Before Width: | Height: | Size: 727 KiB After Width: | Height: | Size: 727 KiB |
Before Width: | Height: | Size: 161 KiB After Width: | Height: | Size: 161 KiB |
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 186 KiB |
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 172 KiB |
27
q1/15dec/fonctions.py
Normal file
@ -0,0 +1,27 @@
|
||||
def plus_grand_bord(w):
|
||||
for k, v in enumerate(w[1:]):
|
||||
if v == w[0]:
|
||||
if w[k+1:] == w[:len(w[k+1:])]:
|
||||
return w[k+1:]
|
||||
return None
|
||||
|
||||
def intersection(v, w):
|
||||
max_inter = ''
|
||||
for (k, v) in enumerate(v):
|
||||
if v in w:
|
||||
i = 1
|
||||
while v[k:k+i] in w:
|
||||
i += 1
|
||||
if i >= len(w):
|
||||
break
|
||||
if len(v[k:k+i]) > len(max_inter):
|
||||
max_inter = v[k:k+i]
|
||||
return max_inter
|
||||
|
||||
|
||||
def palyndrome(mot):
|
||||
inv = [mot[len(mot)-1-i] for i in range(len(mot))]
|
||||
return inv
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(palyndrome('anticonstitutionnelement'))
|
BIN
q1/15dec/serie12.pdf
Normal file
16
q1/renforcement/entrainement_0712/cup.py
Normal file
@ -0,0 +1,16 @@
|
||||
tab = map(int, input().split)
|
||||
|
||||
def nombre_tasse(tab):
|
||||
"""count the ammount of tasse following weird set of rules """
|
||||
start_cup = 0
|
||||
in_cup = False
|
||||
for k, v in enumerate(tab):
|
||||
if v < tab[k+1]:
|
||||
in_cup = True
|
||||
start_cup = k
|
||||
elif v < tab[k-1]:
|
||||
if
|
||||
|
||||
return count
|
||||
|
||||
print(nombre_tasse(tab))
|
BIN
q1/renforcement/entrainement_0712/entrainement.pdf
Normal file
68
q1/renforcement/entrainement_0712/member_list.py
Normal file
@ -0,0 +1,68 @@
|
||||
from datetime import datetime
|
||||
|
||||
class Member:
|
||||
|
||||
"""Represente un membre dans la base de donnee de l'umons """
|
||||
|
||||
def __init__(self, name, surname, faculty, section, register_date = datetime.now().strftime("%Y%m%d"), seen = 0, seen_dates = list()):
|
||||
"""TODO: to be defined.
|
||||
|
||||
:seen: number of time he came to CPUMONS
|
||||
:seen_dates: date when he came
|
||||
|
||||
"""
|
||||
|
||||
self._name = name
|
||||
self._surname = surname
|
||||
self._mail = f"{name}.{surname}@studen.umons.ac.be"
|
||||
self._faculty = faculty
|
||||
self._section = section
|
||||
self._register_date = register_date
|
||||
self._seen = seen
|
||||
self._seen_dates = seen_dates
|
||||
|
||||
def __str__(self):
|
||||
return f"{self._name} {self._surname}, {self._faculty} -> {self._section}; seen {self._seen} time(s)"
|
||||
|
||||
def addSeen(self, date = datetime.now().strftime("%Y%m%d")):
|
||||
self._seen += 1
|
||||
self._seen_dates.append(date)
|
||||
|
||||
def interaction_menu(mbr_list):
|
||||
print("""
|
||||
1) Insert new member
|
||||
2) List members
|
||||
3) Delete a member
|
||||
4) Update member
|
||||
5) Quit
|
||||
""")
|
||||
try:
|
||||
menu_selection = int(input("select your action: "))
|
||||
except:
|
||||
return True
|
||||
|
||||
if menu_selection == 1: # Insert new member
|
||||
name, surname, faculty, section = input("enter: <name surname faculty section> (with space between each input): ").split(' ')
|
||||
mbr_list.append(Member(name, surname, faculty, section))
|
||||
elif menu_selection == 2: # List members
|
||||
for k, v in enumerate(mbr_list):
|
||||
print(k, v)
|
||||
elif menu_selection == 3: # Delete a member
|
||||
toDelUser = input("enter the index of the user you want to delete: ")
|
||||
mbr_list.pop(toDelUser)
|
||||
elif menu_selection == 4: # Update member
|
||||
toUpdateUser = int(input("enter the index of the user you want to update: "))
|
||||
datetime = input("enter the date where he has been seen ( let blank for the current date ): ")
|
||||
if not datetime:
|
||||
mbr_list[toUpdateUser].addSeen()
|
||||
else:
|
||||
mbr_list[toUpdateUser].addSeen(datetime)
|
||||
else: # Menu error/quit
|
||||
return False
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
user_list = list()
|
||||
exit = False
|
||||
while not exit:
|
||||
exit = not interaction_menu(user_list)
|
14
q1/renforcement/entrainement_0712/stringdiff.py
Normal file
@ -0,0 +1,14 @@
|
||||
def diff(in1: str, in2: str) -> list:
|
||||
ret = list()
|
||||
for k, v in enumerate(in1):
|
||||
if in2[k] != v :
|
||||
ret.append((k, v, in2[k]))
|
||||
return ret
|
||||
|
||||
if __name__ == "__main__":
|
||||
in1, in2 = input("entrez la phrase 1:") , input("entrez la phrase 2")
|
||||
diff_ins = diff(in1, in2)
|
||||
if len(diff_ins) == 0:
|
||||
print("Phrases identiques")
|
||||
else:
|
||||
print(diff_ins)
|