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!

Search & Filtering

Write a program which should consists of a user defined function “Task ()” [Function returns no 

value]. Pass 1D array to the function, along with number of elements of array. Function should delete 

the largest element from the passed array. Display the final array after deletion [After function is called] 

in the main () function


Invent your own function that does some useful computation of your choosing. Use incremental development, and record each stage of the development process as you go. Finally, print output that demonstrates that the function works as you intended.

Include all of the following in your Learning Journal:

  • An explanation of each stage of development, including code and any test input and output.
  • The output of three calls to your function with different arguments.

Incremental development. Do the exercise at the end of that section:

As an exercise, use incremental development to write a function called hypotenuse that returns the length of the hypotenuse of a right triangle given the lengths of the other two legs as arguments. Record each stage of the development process as you go. (Downey, 2015)

After the final stage of development, print the output of hypotenuse(3, 4) and two other calls to hypotenuse with different arguments.

Include all of the following in your Learning Journal:

  • An explanation of each stage of development, including code and any test input and output.
  • The output of hypotenuse(3,4).
  • The output of two additional calls to hypotenuse with different arguments.

Using recursion and the is_divisible function from Section 6.4. Your program may assume that both arguments to is_power are positive integers. Note that the only positive integer that is a power of "1" is "1" itself.

After writing your is_power function, include the following test cases in your script to exercise the function and print the results:

print("is_power(10, 2) returns: ", is_power(10, 2))

print("is_power(27, 3) returns: ", is_power(27, 3))

print("is_power(1, 1) returns: ", is_power(1, 1))

print("is_power(10, 1) returns: ", is_power(10, 1))

print("is_power(3, 3) returns: ", is_power(3, 3))

You should submit a script file and a plain text output file (.txt) that contains the test output. Multiple file uploads are permitted. Don’t forget to include descriptive comments in your Python code.


"Debugging" lists three possibilities to consider if a function is not working.

  • Describe each possibility in your own words.
  • Define "precondition" and "postcondition" as part of your description.
  • Create your own example of each possibility in Python code. List the code for each example, along with sample output from trying to run it.

Debugging lists three possibilities to consider if a function is not working.

  • Describe each possibility in your own words.
  • Define "precondition" and "postcondition" as part of your description.
  • Create your own example of each possibility in Python code. List the code for each example, along with sample output from trying to run it.

List three possibilities to consider if a function is not working.


Section 6.9 of your textbook ("Debugging") lists three possibilities to consider if a function is not working.


Describe each possibility in your own words.



Define "precondition" and "postcondition" as part of your description.


Do Exercise 6.4 from your textbook using recursion and the is_divisible function from Section 6.4. Your program may assume that both arguments to is_power are positive integers. Note that the only positive integer that is a power of "1" is "1" itself.



After writing your is_power function, include the following test cases in your script to exercise the function and print the results:



print("is_power(10, 2) returns: ", is_power(10, 2))


print("is_power(27, 3) returns: ", is_power(27, 3))


print("is_power(1, 1) returns: ", is_power(1, 1))


print("is_power(10, 1) returns: ", is_power(10, 1))


print("is_power(3, 3) returns: ", is_power(3, 3))



You should submit a script file and a plain text output file (.txt) that contains the test output. Multiple file uploads are permitted. Don’t forget to include descriptive comments in your Python code.


Part 2

Invent your own function that does some useful computation of your choosing. Do not copy the function from somewhere else. Use incremental development, and record each stage of the development process as you go. Finally, print output that demonstrates that the function works as you intended.

Include all of the following in your Learning Journal:

  • An explanation of each stage of development, including code and any test input and output.
  • The output of three calls to your function with different arguments.
LATEST TUTORIALS
APPROVED BY CLIENTS