Jul-09-2019, 12:26 AM
Having trouble with this one.
The problem reads below:
You will need to write two functions for this problem. The first function, "divide" that takes in any number and returns that same number divided by 2. The second function called "sum" should take any number, divide it by 2, and add 6. It should return this new number. You should call the divide function within the sum function. Do not worry about decimals.
Here's my attempt:
Not quite sure why.
The problem reads below:
You will need to write two functions for this problem. The first function, "divide" that takes in any number and returns that same number divided by 2. The second function called "sum" should take any number, divide it by 2, and add 6. It should return this new number. You should call the divide function within the sum function. Do not worry about decimals.
Here's my attempt:
def divide (div): d2 = div/2 print(d2) return d2 divide(10) def sum (num): s1 = divide(num) s2 = s1 + 6 print(s2) return s2 num = 12Here's the output:
Output:5.0
It seems to execute "divide" but not "sum".Not quite sure why.