Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ex3
- from numpy import *
- t=array([str]*100)
- t1=array([str()]*100)
- def saisie():
- while True:
- n=int(input("n="))
- if 2<n<20: break
- return n
- def remplir1(n):
- for i in range(n):
- while True:
- t[i]=input("t["+str(i)+"]:")
- if len(t[i])>0: break
- return t,n
- def remplir2(m):
- for i in range(m):
- y=i+97
- t1[i]=chr(y)
- return t1,m
- def commun(t,t1,n,m):
- ch=""
- for i in range(m):
- s=0
- for j in range(n):
- if t[j].find(t1[i])!=-1 :
- s=s+1
- if s==n:
- ch=t1[i]+","+ch
- return ch[:-1]
- def afficher(t1,m):
- for i in range(m):
- print(t1[i],end="/")
- print()
- m=26
- n=saisie()
- t,n=remplir1(n)
- t1,m=remplir2(m)
- afficher(t1,m)
- print("les caractéres communs sont:", commun(t,t1,n,m))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement