0% found this document useful (0 votes)
0 views6 pages

Sujets Infos

Uploaded by

alouiisaifeddine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views6 pages

Sujets Infos

Uploaded by

alouiisaifeddine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

SUJETS

INFOS
SUJET1:
from numpy import array
def verif(ch):
test=True
i=0
while (i<len(ch) and test==True):
if "A"<=ch[i]<="Z":
i=i+1
else:
test=False
return(test)

def mot_princ():
ch=input("donner une mot")
while not (len(ch)!=0 and verif(ch)):
ch=input("donner un mot")
return(ch)

def taille ():


global N
N=int(input("donner N"))
while not (5<=N<=20):
N=int(input("donner N"))
def remp (T,N,x):
for i in range(N):
T[i]=input("donner T["+str(i)+"]")
while not (verif(T[i]) and len(x)==len(T[i]) ):
T[i]=input("donner T["+str(i)+"]" )

def deg_resm (ch1,ch2):


k=0
for i in range(len(ch1)):
if ch1[i]==ch2[i]:
k=k+1
s=round(((k/len(ch1))*100),2)
return(s)

def aff (T,N,ch):


for i in range (N):
s=deg_resm(ch,T[i])
print(f'dr({ch},{T[i]})={s}')

k=mot_princ()
taille()
T=array([str]*N)
remp(T,N,k)
aff(T,N,k)
SUJET2:
from numpy import array

def taille():
global N
N=int(input("donner N: "))
while not (5<=N<=25):
N=int(input("donner N "))

def verif(c):
test=True
i=0
while (i<len(c) and test==True):
if ("A"<=c[i]<="Z" or c[i]==" "):
i=i+1
else:
test=False
return test

def remp(T,N):
for i in range(N):
T[i]=input("donner T["+str(i)+"]")
while not(verif(T[i])):
T[i]=input("donner T["+str(i)+"]")
def voy(ch):
s=0
for i in range(len(ch)):
if ch[i] in ["A","O","I","Y","E","U"]:
s=s+1
return(s)

def aff(T,N):
for i in range(N):
if voy(T[i])==5:
print(T[i])

taille()
T=array([str]*N)
remp(T,N)
aff(T,N)

SUJET3:
def saisir():
global m,n
m=int(input("donner m: "))
n=int(input("donner n: "))
while not (100<=n<m):
m=int(input("donner m: "))
n=int(input("donner n: "))
def Harshad (x):
s=0
ch=str(x)
test=False
for i in range (len(ch)):
s=s+int(ch[i])
if x%s==0:
test=True
return test

def premier(y):
c=str(y)
i=2
quest=True
while (i<y and quest==True):
if y%i==0:
quest=False
else:
i=i+1
return quest

def aff(n,m):
for i in range (n,m+1):
if (premier(i-1) and Harshad(i)):
print(f'{i} car {i} est harshad et son precedeur {i-1} est un nombre premier')

saisir()
aff(n,m)

You might also like