Questions: 5 831

Answers by our Experts: 5 728

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

Given a number N, write a program to print a triangular pattern of N lines with numbers as shown below.

N = 4


Part 1

The volume of a sphere is 4/3πr3, where π has the value of "pi" given in Section 2.1 of your textbook. Write a function called print_volume (r) that takes an argument for the radius of the sphere, and prints the volume of the sphere.

Call your print_volume function three times with different values for radius.

Include all of the following in your Learning Journal:

  • The code for your print_volume function.
  • The inputs and outputs to three calls of your print_volume.

Part 2

Write your own function that illustrates a feature that you learned in this unit. The function must take at least one argument. The function should be your own creation, not copied from any other source. Do not copy a function from your textbook or the Internet.

Include all of the following in your Learning Journal:

  • The code for the function that you invented.
  • The inputs and outputs to three calls of your invented function.
  • A description of what feature(s) your function illustrates. 

Using IDLE development you must use script mode to develop your script . Your script must use meaningful variable names and have comments that describe what is happening in your script . Comments may describe the assignment of value to a variable , a computation and the assignment of the result to a variable , or the display of the result . Write a function in this file called nine_lines that uses the function three_lines to print a total of nine lines . Now add a function named clear_screen that uses a computation of functions nine_lines ,three_lines ,and new_lines to print a total of twenty- five lines . The last lines of your program should call first nine_lines and then the clear_screen function.


Given an integer N, write a program to print the hollow diamond pattern in 2*N rows and 2*N columns, similar to the pattern shown below


Multiples of 3

You are given

N inputs. Print the numbers that are multiples of 3.Input

The first line of input is an integer

N. The next N lines each contain an integer as input.



You are given

N inputs. Print the given inputs until you encounter a multiple of 5.Input

The first line of input is an integer

N. The next N lines each contain an integer as input.


You are given N inputs. Write a program to print the first prime number in the given inputs.

Input

The first line of input is an integer

N. The next N lines each contain an integer.


Call your function from Example 1 three times with different kinds of arguments: a value, a variable, and an expression. Identify which kind of argument is which.

As programs get bigger and more complicated, they get more difficult to read.this is one reason why programmers should use comments in their code


You are given N inputs. Print the given inputs until you encounter a multiple of 5.


LATEST TUTORIALS
APPROVED BY CLIENTS