0
I written below code but got error, could you help me out through this?
a= int (input("Enter:")) if a%2==0: print ("Even") elif a%3==0: print ("Fine") else : print ("Odd")
3 Respostas
+ 2
"""
Your code doesn't produce any runtime error, but if you don't get expected result (ie: input 42 may let you expect "Fine" as output because it's 3 divisible, but output "Even" because it's first tested for 2 divisibility), you may change your code as:
"""
a= int (input("Enter:")) 
if a%3==0: 
    print ("Fine") 
elif a%2==0:
    print ("Even") 
else : 
    print ("Odd")
# (indenting with more than only one space improve readability)
# However, if you expect "Fine" AND "Even" for values such as 42, you may write:
a= int (input("Enter:")) 
if a%2==0:
    print ("Even") 
else : 
    print ("Odd")
if a%3==0: 
    print ("Fine")
0
a= int (input("Enter:")) 
if a%2==0:
 print ("Even") 
elif a%3==0: 
 print ("Fine") 
else : 
 print ("Odd")
- 1
Thanks



