mercredi 9 décembre 2020

while using def function i got this error

def even_or_odd(num):

if num%2==0:

    return "the number {} is Even".fromat(num)

else:

    return "the number {} is Odd".format(num)    

AttributeError Traceback (most recent call last) in ----> 1 even_or_odd(20)

in even_or_odd(num) 1 def even_or_odd(num): 2 if num%2==0: ----> 3 return "the number {} is Even".fromat(num) 4 else: 5 return "the number {} is Odd".format(num)

AttributeError: 'str' object has no attribute 'fromat'

Aucun commentaire:

Enregistrer un commentaire