samedi 2 octobre 2021

if statement with inline assignment in python3

Given the following statement in python (3):

import math
for i in range(100):
    if((result = math.factorial(i)) % 10  == 0):
        print(i,"->",result)

Isn't it possible (like in C)?

Aucun commentaire:

Enregistrer un commentaire