Question: 1) Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values,
1) Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. For example: lone_sum(3, 2, 3) returns a value of 2. Write a main method to test all cases in clearly formatted output. Name this file LoneSum.py
Determine Test Cases:
| a | b | c | Result (return value) |
def lone_sum(a, b, c):
2) Given 3 int values, a b c, return their sum. However, if any of the values is a teen -- in the range 13..19 inclusive -- then that value counts as 0, except 15 and 16 do not count as a teens. Write a separate helper "def fix_teen(n):" that takes in an int value and returns that value fixed for the teen rule. In this way, you avoid repeating the teen code 3 times (i.e. "decomposition"). Write a main method to test all cases in clearly formatted output. Name this file TeenSum.py
Determine Test Cases:
| a | b | c | Result (return value) |
def no_teen_sum(a, b, c):
def fix_teen(n):
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
