Answer to Question #83380 in Python for Andrea Murphy

Question #83380
2. SumTwenty: Given 2 ints, a and b, print their sum. However, sums in the range 10..19 inclusive, are forbidden, so in that case just print 20.
1
Expert's answer
2018-11-29T12:10:12-0500

def sum_twenty(a, b):

total = a+b

if (total > 9) and (total < 20):

return 20

else:

return total



a = int(input("Enter a:"))

b = int(input("Enter b:"))

print(sum_twenty(a, b))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS