mots réservés » utilisés par le langage lui-même (if, elif, while, for, else, print,...).
* Instruct... cs.python.org/3/reference/compound_stmts.html#the-if-statement|documentation officielle]] ou [[http://... ou "faux" (false). Exemple :
<code python>
a = 0
if a > 0 :
print("a est positif")
print("car... " sous-tend une condition alternative. un simple "if" correspond à une expression conditionnelle.
*
Use]] Anup Das, Medium, 22/11/2022
==== One-line if - then - else (ternary operator) ====
<code python>
u = 10
v = 100
reponse = "u plus grand que v" if u > v else "v plus grand ou égal à u"
print(repon
nelle ====
Instruction d’exécution conditionnelle if...elif...else (si...sinon-si...autrement)
* Commence par **if expression** :
* Si l’expression est vraie, le ... code python>
a = int(input('Donnez une note ? '))
if a >= 18:
print("Excellent")
elif a >= 16:
... , dt, flag
x1, y1 = x1 +vx*dt, y1 + vy*dt
if x1 < 0 or x1 > 220:
vx=-vx
if y1 < 0
(n):
for x in range(2,int(n**0.5)+1):
if n % x == 0:
return False
return T... f primelist(n):
return [a for a in range(2,n) if isprime(a)]
p=primelist(1000)
print(p)
</code>
... :
ncur += 1
return [a for a in li if a != 0] # renvoie une liste avec les élements no... com/software-development/python/code/216880/check-if-a-number-is-a-prime-number-python]]
* [[http://
i d'éléments entiers.
"""
def quicksort(li):
if li == []: return []
pivot = li[0]
equal =... [pivot]
lesser = quicksort([x for x in li[1:] if x <= pivot]) # si x < pivot : élimination des do... ublons
greater = quicksort([x for x in li[1:] if x > pivot])
return lesser + equal + greater
... sible :
<code python>
...
def quicksort(li):
if li == []: return []
pivot = li[0]
return
c in adn:
for i in range(len(ACGT)):
if c == ACGT[i]:
count[i] +=1
for val in... ''.join(sorted(list(set([v for k,v in dic.items() if v != "STOP"]))))
print(aminoacids)
# UniProt Pro
n2 = len(t) # ordre du second polynôme
if n1 > n2: # premier polynôme de plus haut degré ... n = len(a)-1
for j in range(n+1):
if j%2 == 0:
p.append(a[j])
erminer quel radioboutton est sélectionné
if equation_index == 0: #si aucun des radios b... == 4:
rep=14+log10(float(ca))
if rep<0 or rep>14:
fenwarn = Toplevel(f
A living cell dies
of overcrowding or loneliness if it has more than three or fewer than
two neighbours; a dead cell is brought to life if it has exactly three
neighbours (determined in Ce... will be alive at the next iteration."""
if self.state==Cell.LIVE and \
(numNeigh... ,newstate):
self.state = newstate
if self.state==Cell.LIVE:
self["bg"] = "
, dt, flag
x1, y1 = x1 +vx*dt, y1 + vy*dt
if x1 < 0 or x1 > 220:
vx=-vx
if y1 < 0 or y1 > 220:
vy = -vy
can1.coords(oval1,x1,y1,x1+30,y1+30)
if flag >0:
fen1.after(2,move) # boucler a... "démarrage de l'animation"
global flag
if flag ==0: # pour éviter que le bouton ne puisse l