Answer the question
In order to leave comments, you need to log in
How to correctly formulate an exception?
How to correctly formulate an exception when it is necessary that the value be given in all cases except those that end in 11
a=int(input())
if a==1:
print(a, 'программист')
b=a%10
c=a%100
if (b==1 and (c!=11)):
print(a, 'программист')
Answer the question
In order to leave comments, you need to log in
Maybe you should not turn the input number into int
. Let there be a line. You can then write s.endswith('11')
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question