1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
garri49 [273]
3 years ago
15

Write definitions for the following two functions:______

Engineering
1 answer:
lawyer [7]3 years ago
6 0

Answer:

<em>Written in Python</em>

def SumN(n):

     total = 0

     for i in range(1,n+1):

           total = total + i

     print("Total: ",total)

def SumNCubes(n):

     total = 0

     for i in range(1,n+1):

           total = total + i**3

     print("Cube: ",total)

n = int(input("User Input: "))

if n > 0:

     SumN(n)

     SumNCubes(n)

Explanation:

The SumN function is defined here

def SumN(n):

This line initializes the total to 0

     total = 0

The following iteration compute the required sum

<em>      for i in range(1,n+1): </em>

<em>            total = total + i </em>

This line outputs the calculated sum

     print("Total: ",total)

The SumNCubes function is defined here

def SumNCubes(n):

This line initializes the total to 0

     total = 0

The following iteration compute the required sum of cubes

<em>      for i in range(1,n+1): </em>

<em>            total = total + i**3 </em>

This line outputs the calculated sum of cubes

     print("Cube: ",total)

The main starts here; The first line prompts user for input

n = int(input("User Input: "))

The next line checks if input is greater than 0; If yes, the two defined functions are called

if n > 0:

     SumN(n)

     SumNCubes(n)

You might be interested in
A gas stream contains 18.0 mole% hexane and the remainder nitrogen. The stream flows to a condenser, where its temperature is re
Anna [14]

Answer:

A. 72.34mol/min

B. 76.0%

Explanation:

A.

We start by converting to molar flow rate. Using density and molecular weight of hexane

= 1.59L/min x 0.659g/cm³ x 1000cm³/L x 1/86.17

= 988.5/86.17

= 11.47mol/min

n1 = n2+n3

n1 = n2 + 11.47mol/min

We have a balance on hexane

n1y1C6H14 = n2y2C6H14 + n3y3C6H14

n1(0.18) = n2(0.05) + 11.47(1.00)

To get n2

(n2+11.47mol/min)0.18 = n2(0.05) + 11.47mol/min(1.00)

0.18n2 + 2.0646 = 0.05n2 + 11.47mol/min

0.18n2-0.05n2 = 11.47-2.0646

= 0.13n2 = 9.4054

n2 = 9.4054/0.13

n2 = 72.34 mol/min

This value is the flow rate of gas that is leaving the system.

B.

n1 = n2 + 11.47mol/min

72.34mol/min + 11.47mol/min

= 83.81 mol/min

Amount of hexane entering condenser

0.18(83.81)

= 15.1 mol/min

Then the percentage condensed =

11.47/15.1

= 7.59

~7.6

7.6x100

= 76.0%

Therefore the answers are a.) 72.34mol/min b.) 76.0%

Please refer to the attachment .

4 0
3 years ago
Discuss 7 habits of highly effective people and how important are ethics in today's society​
kompoz [17]

Answer:

Explanation:

The 7 Habits of Highly Effective People, is a book written and first published in 1989. It is a business and self-help book that was written by Stephen Covey. The seven habits include

Being proactive

Starting anything with the end in mind

First things first

Always thinking towards a win-win situation

Seeking initially to understand, then going on to want to be understood

Synergize, and lastly

Growing

7 0
3 years ago
Which of the following is an example of a civil engineer demonstrating problem sensitivity? (Select all that apply.)
zaharov [31]

Answer:

all of the above hidtsybkhitonp

Explanation:

nyppinnoxtstuity433ongdhfkgt

8 0
3 years ago
What is a heat engine? State its efficiency (a sketch would be appropriate).
dimulka [17.4K]

Answer:

\eta =\dfrac{Q_1-Q_2}{Q_1}

Explanation:

Heat engine

 Heat engine is a device which produce work while consuming some amount of energy .This engine works in cycle.In other words we can say that Heat engine is a device which covert thermal or chemical energy in to mechanical energy and after that this mechanical energy can be use for producing mechanical work.

Heat engine takes heat from high temperature and rejects heat to lower temperature and producing work.

We know that efficiency given as

\eta =\dfrac{out\ put}{in\ put}

From diagram we can say that

Q_1=Q_2+W

So efficiency

\eta =\dfrac{w}{Q_1}

\eta =\dfrac{Q_1-Q_2}{Q_1}

3 0
3 years ago
A tungsten matrix with 20% porosity is infiltrated with silver. Assuming that the pores are interconnected, what is the density
daser333 [38]

Answer:

15.4 g/cm³, 17.4 g/cm³

Explanation:

The densities can be calculated using the formula below

ρ = (fraction of tungsten × ρt ( density of tungsten)) + (fraction of pores × ρp( density of pore)

fraction of tungsten = (100 - 20 ) % = 80 / 100 = 0.8

a) density of the before infiltration =  ( 0.8 × 19.25) + (0.2 × 0) = 15.4 g/cm³

b) density after infiltration with silver

fraction occupied by silver = 20 / 100 = 0.2

density after infiltration with silver = ( 0.8 × 19.25) +  (0.2 × 10) = 17.4 g/cm³

5 0
3 years ago
Other questions:
  • Two soils are fully saturated with liquid (no gas present) and the soils have the same void ratio. One soil is saturated with wa
    9·1 answer
  • What is the name for a part of a window that joins two windows into a single unit?
    12·1 answer
  • The function below takes a single parameter, a list of numbers called number_list. Complete the function to return a string of t
    14·1 answer
  • 1. The area of the given triangle is 25 square units. What is the value of x?<br> X+2
    8·1 answer
  • If you embed a multimedia file, you reduce the bandwidth your Web site must manage.
    7·1 answer
  • 1. One of these is NOT a type of pneumatic tool. Which one?
    10·1 answer
  • What is the type of the car which has no gasoline as a fuel, but hydrogen or water?​
    12·2 answers
  • (Laminar flow) A fluid flows through two horizontal pipes of equal length which are connected together to form a pipe of length
    6·1 answer
  • If you always follow the same five steps to get ready for school, then you are following an algorithm.
    5·2 answers
  • Your driver license will be _____ if you race another driver on a public road, commit a felony using a motor vehicle, or are fou
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!