Vous êtes sur la page 1sur 1

25/09/2023 10:56 detection.

py

1 from numpy import*


2 from pickle import*
3 def saisie():
4 n=int(input("n="))
5 while not 5<=n<=15 :
6 n=int(input("n="))
7 return n
8
9 def remplir(t,n):
10 for i in range(n):
11 t[i]=str(input("code ="))
12 while not( t[i].isdigit() and len(t[i])==5):
13 t=st[i]r(input("code ="))
14 def stocker(t,n,f,e):
15 for i in range(n):
16 e.num=i+1
17 e.deg=int(t[i][:2])
18 e.q=int(t[i][2:5])
19 print(f,e)
20 f.close()
21 def journal(f1,f2,f,e):
22 e=load(f)
23 maxi=e.deg
24 finfichier=False
25 while finfichier==False :
26 try:
27 e=load(f)
28 if e.deg > maxi:
29 maxi=e.deg
30 except:
31 finfichier=True
32 f.close()
33 f1=open("detection.dat","rb")
34 f2=open("rapport.txt","w")
35 f2.write("le plus grand degre d'urgance est = ",str(maxi)+"\n")
36 f2.write("les appartement concernes sont :")
37 finfichier=False
38 while finfichier==False :
39 try:
40 e=load(f)
41 if e.deg == maxi:
42 f2write(str(e.num)+"avec une quantité de fummé "+str(e.q))
43 except:
44 finfichier=True
45 f.close()
46 f2.close()
47 f1.close()
48
49
50
51 f=open("detection.dat","wb")
52 f1=open("detection.dat","rb")
53 f2=open("rapport.txt","wb")
54 n=saisie()
55 t=array([str]*n)
56 remplir(t,n)
57 stocker(t,n,f,e)
58 journal(f1,f2,f,e)

file:///C:/PySchool/3.10-32-bit/user_data/thonny/temp/thonny_c1109bnc.html 1/1

Vous aimerez peut-être aussi