def convert(number):
why = []
if number %3 == 0 :
why.append("Pling")
elif number % 5 == 0:
why.append("Plang")
elif number % 7 == 0:
why.append("Plong")
else:
return str(number)
return why[0]
Code Run
self.assertEqual(convert(15), "PlingPlang")
Test Failure
AssertionError: 'Pling' != 'PlingPlang'
- Pling
+ PlingPlang
when we get number like 15 35 105 which will have more than one factors then the dictionary should append both pling and plong but its is showing only pling