Question: Use python 2.7 Write a function called add_n_times( value, n ) that adds the provided value onto itself n times. For example, add_n_times( 10, 5
Use python 2.7
Write a function called add_n_times( value, n ) that "adds" the provided value onto itself n times. For example, add_n_times( 10, 5 ) should print out the value 50, since 10 added onto itself five times is 10 + 10 + 10 + 10 + 10 = 50. On the other hand, with strings, add operation behaves differently, but we need not worry, because when we add strings together using the "+" operator, we concatenate them. Therefore, if we call add_n_times( "Hello", 3 ) the value "HelloHelloHello" should be printed out.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
