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
alexandr402 [8]
3 years ago
7

5. Create a function named second_a that uses a list comprehension. The function will take a single integer parameter n. Find ev

ery number from 1 to n (inclusive) that is a palindrome which starts with the digit 3. Do not user a helper function.
Engineering
1 answer:
Mekhanik [1.2K]3 years ago
8 0

Answer:

//Program was implemented using C++ Programming Language

// Comments are used for explanatory purpose

#include<iostream>

using namespace std;

unsigned int second_a(unsigned int n)

{

int r,sum=0,temp;

int first;

for(int i= 1; I<=n; i++)

{

first = n;

//Check if first digit is 3

// Remove last digit from number till only one digit is left

while(first >= 10)

{

first = first / 10;

}

if(first == 3) // if first digit is 3

{

//Check if n is palindrome

temp=n; // save the value of n in a temporary Variable

while(n>0)

{

r=n%10; //getting remainder

sum=(sum*10)+r;

n=n/10;

}

if(temp==sum)

cout<<n<<" is a palindrome";

else

cout<<n<<" is not a palindrome";

}

}

}

Explanation:

The above code segments is a functional program that checks if a number that starts with digit 3 is Palindromic or not.

The program was coded using C++ programming language.

The main method of the program is omitted.

Comments were used for explanatory purpose.

You might be interested in
Write a function named "read_prices" that takes one parameter that is a list of ticker symbols that your company owns in their p
ohaa [14]

Answer:

import pandas pd

def read_prices(tickers):

price_dict = {}

# Read ingthe ticker data for all the tickers

for ticker in tickers:

# Read data for one ticker using pandas.read_csv  

# We assume no column names in csv file

ticker_data = pd.read_csv("./" + ticker + ".csv", names=['date', 'price', 'volume'])

# ticker_data is now a panda data frame

# Creating dictionary

# for the ticker

price_dict[ticker] = {}

for i in range(len(ticker_data)):

# Use pandas.iloc  to access data

date = ticker_data.iloc[i]['date']

price = ticker_data.iloc[i]['price']

price_dict[ticker][date] = price

return price_dict  

7 0
4 years ago
Gaining unauthorized access to a computer's data is called (5 points)
yanalaym [24]
Hacking is correcttttttttt
6 0
3 years ago
Obtain a relation for the logarithmic mean temperature difference for use in the LMTD method?
kolezko [41]

Answer:

The log mean temperature difference is:

ΔT,lm=(ΔT1-ΔT2)/㏑(ΔT1/ΔT2)

Explanation:

To evaluate the equivalent average temperature difference between two fluids we consider a parallel-flow double-pipe heat exchanger (see attached diagram). The temperature of the hot and cold fluids is large at the inlet of the heat exchanger and decreases exponentially toward the outlet.  

We can assume that the outer surface of the heat exchanger is well insulated and that heat transfer only occurs between the two fluids. We can also assume negligible kinetic and potential. The energy balance on each fluid can be written as the rate of heat loss from the hot fluid is equal to the rate of heat gained by the cold fluid in any section of the heat exchanger:

Q = -m,h×c,ph×dT,h   (1)

where Q=rate of heat loss, m=mass flow rate, c,ph=heat capacity of the hot fluid, dT,h= differential temperature of the hot fluid

Q = m,c×c,pc×T.c  (2)

where Q=rate of heat loss, m=mass flow rate, c,ph=heat capacity of the cold fluid, dT,h= differential temperature of the cold fluid

The temperature of the hot fluid change is negative and is added to make Q positive. Solving equations 1 and 2 in terms of dT:

dT.h = - Q/(m,h×c,ph)

dT.c =  Q/(m,c×c,pc)

and taking the difference:

dT,h-dT,c= d(T,h - T,c) = -Q(1/(m,h×c,ph) + 1/(m,c×c,pc)) (3)

The heat transfer rate in the differential section of the heat exchanger can be expressed as:

Q = U(T,h-T,c)×dA,s  (4)

where U=overall heat transfer coefficients, dA,s = differential sectional area. Substitute equation 4 into 3:

d(T,h - T,c)/(T,h - T,c) = -U×dA,s×(1/(m,h×c,ph) + 1/(m,c×c,pc))  (5)

Integrating equation 5:

㏑((T,h out - T,c out)/(T,h in - T,c in)) = -U×A,s×(1/(m,h×c,ph) + 1/(m,c×c,pc))  (6)

The first law of thermodynamics requires the rate of heat transfer from hot and cold fluid to be equal.

Q= m×c, pc×(T, c out-T, c in)  (7)

Q= m×c, ph×(T,h out-T, h in)   (8)

Solve equations 7 and 8 for m,c×c, pc and m,h×c, ph and substituting into equation 6:

Q = U×A,s×ΔT,lm

Where the log mean temperature difference is:

ΔT,lm=(ΔT1-ΔT2)/㏑(ΔT1/ΔT2)

Download pdf
8 0
3 years ago
How do customs in JROTC demonstrate respect for our nation and the JROTC program?
SashulF [63]

Answer:

The customs of JROTC demonstrates respect for the nation and the JROTC program by doing the following;

1)  Standing at an attention position facing the Colors or the direction from which the music is heard and saluting whenever the National Anthem is playing

2) Obeying the rules and regulations and abiding by all JROTC customs, courtesies and protocols including the observance of the protocols regarding the use of phones, going through a doorway, manner of address and what to do when a higher rank, officer or dignitary enters the room.

Explanation:

Courtesy in the military is an expression of respect and or consideration for other persons or a notion

6 0
3 years ago
Niobium (Nb) has an atomic radius of 0.1430 nm and a density of 8.57 g/cm3 . Determine whether it has an FCC or a BCC crystal st
Doss [256]

Answer : The crystal structure of Niobium is, BCC (Z=2)

Explanation :

Nearest neighbor distance, r = 0.1430nm=1.430\times 10^{-8}cm (1nm=10^{-7}cm)

Atomic mass of niobium (Nb) = 92.91 g/mole

Avogadro's number (N_{A})=6.022\times 10^{23} mol^{-1}

First we have to calculate the cubing of edge length of unit cell for BCC and FCC crystal lattice.

For BCC lattice : a^3=(\frac{4r}{\sqrt{3}})^3=(\frac{4\times 1.430\times 10^{-8}cm}{\sqrt{3}})^3=3.60\times 10^{-23}cm^3

For FCC lattice : a^3=(\sqrt{8}r)^3=(\sqrt{8}\times 1.430\times 10^{-8}cm)^3=6.62\times 10^{-23}cm^3

Now we have to calculate the density of unit cell for BCC and FCC crystal lattice.

Formula used :

\rho=\frac{Z\times M}{N_{A}\times a^{3}} .............(1)

where,

\rho = density

Z = number of atom in unit cell (for BCC = 2, for FCC = 4)

M = atomic mass

(N_{A}) = Avogadro's number

a = edge length of unit cell

Now put all the values in above formula (1), we get

\rho=\frac{2\times (92.91g/mol)}{(6.022\times 10^{23}mol^{-1}) \times (3.60\times 10^{-23}Cm^3)}=8.57g/Cm^{3}

\rho=\frac{4\times (92.91g/mol)}{(6.022\times 10^{23}mol^{-1}) \times (6.62\times 10^{-23}Cm^3)}=9.32g/Cm^{3}

From this information we conclude that, the given density is approximately equal to the density of BCC unit lattice.

Therefore, the crystal structure of Niobium is, BCC (Z=2)

3 0
3 years ago
Other questions:
  • The Clausius inequality expresses which of the following laws? i. Law of Conservation of Mass ii. Law of Conservation of Energy
    8·1 answer
  • Water (cp = 4180 J/kg·°C) enters the 2.5 cm internal diameter tube of a double-pipe counter-flow heat exchanger at 17°C at a rat
    7·1 answer
  • B1) 20 pts. The thickness of each of the two sheets to be resistance spot welded is 3.5 mm. It is desired to form a weld nugget
    12·1 answer
  • Consider a regenerative gas-turbine power plant with two stages of compression and two stages of expansion. The overall pressure
    11·1 answer
  • You are evaluating the lifetime of a turbine blade. The blade is 4 cm long and there is a gap of 0.16 cm between the tip of the
    9·1 answer
  • Under EPA's regulations, which of the following methods can be used to pressurize an R11 or R123 system for the purpose of openi
    11·1 answer
  • Yooo. does anyone have tin foil and tape mask that they can take a picture of and send it ?
    5·1 answer
  • Affect the amount and rate the alcohol reaches the<br> bloodstream.
    10·1 answer
  • Technician A states that air tools generally produce more noise than electric tools, so wear ear protection when using air tools
    8·1 answer
  • Why is it important to follow the engineering design process before building a prototype
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!