Guys which code used find Number which are ending with 9(or any other particular number)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guys which code used find Number which are ending with 9(or any other particular number)?

27th Jun 2020, 4:21 PM
Mohammad Bilal
Mohammad Bilal - avatar
2 Answers
+ 13
str(number).endswith(str(digit)) or str(number)[-1] == str(digit) or number % 10 == digit or number - (number // 10 * 10) == digit
27th Jun 2020, 4:30 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
str(number) [::-1][0]==digit
27th Jun 2020, 5:07 PM
Oma Falk
Oma Falk - avatar