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")

13th Jan 2018, 7:04 PM
Girish
Girish - avatar
3 odpowiedzi
+ 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")
13th Jan 2018, 7:14 PM
visph
visph - avatar
0
a= int (input("Enter:")) if a%2==0: print ("Even") elif a%3==0: print ("Fine") else : print ("Odd")
13th Jan 2018, 7:05 PM
Girish
Girish - avatar
- 1
Thanks
13th Jan 2018, 7:17 PM
Girish
Girish - avatar