You are on page 1of 2

Correction bac 2022 sujet Super-Premier

#bibliothèques
from PyQt5.uic import loadUi #programme principal
from PyQt5.QtWidgets import * app=QApplication([])
win=loadUi('superpremier.ui')
#modules win.show()
def premier(x): win.bverifier.clicked.connect(play)
test=True app.exec_()
for i in range(2,x //2+1):
if x%i==0:
test=False
return test
def superpremier(n):
x=int(n)
while (x !=0) and premier(x):
print(x)
x =x //10
return x == 0

def affsupeerpremier(n):
if n.isnumeric()==False:
msg='nombre invalide vérifier svp'
elif superpremier(n):
msg=n+' est super premier'
else:
msg=n+" n'est pas super premier"
return msg

def play():
n=win.n.text()
win.msg.setText(affsupeerpremier(n))
Correction bac 2022 sujet Super-Premier

You might also like