answer.
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
joja
8 days ago
15

NEEDS TO BE IN PYTHON:ISBN-13 is a new standard for indentifying books. It uses 13 digits d1d2d3d4d5d6d7d8d910d11d12d13 . The la

st digit d13 is a checksum, which is calculated from the other digits using the following formula:10 - (d1 + 3*d2 + d3 + 3*d4 + d5 + 3*d6 + d7 + 3*d8 + d9 + 3*d10 + d11 + 3*d12) % 10If the checksum is 10, replace it with 0. Your program should read the input as a string. Display "incorrect input" if the input is incorrect.Sample Run 1Enter the first 12 digits of an ISBN-13 as a string: 978013213080The ISBN-13 number is 9780132130806Sample Run 2Enter the first 12 digits of an ISBN-13 as a string: 978013213079The ISBN-13 number is 9780132130790

Engineering
1 answer:
mote1985 [204]8 days ago
4 0

Answer:

Below is the code relevant to this question:

n=input("Enter the first 12 digits of an ISBN-13 as a string:")#this defines isbn as the input variable

if len(n)!=12: #this if statement checks if the input is 12 digits long

   print("incorrect input") #outputs an error message

elif n.isdigit()==False: #this else if statement checks if the input is all digits

   print("incorrect input") #outputs an error message

else:#defining the else block

   s=0 #initializes the integer variable s to 0

   for i in range(12):#a loop to sum the input digits

       if i%2==0: #checks if the index is even

           s=s+int(n[i])#adds even digits to s  

       else: #this else block handles odd indices

           s=s+int(n[i])*3 #adds odd digits multiplied by 3 to s

   s=s%10#calculates the remainder

   s=10-s#finds the complement of the remainder

   if s==10: #checks if s equals 10  

       s=0#sets s to zero if the condition is met

   n=n+s.__str__() #final output is generated

Output:

please find attached file.

Explanation:The Python code above uses the variable "n" to accept user input as a string and utilizes conditional statements to validate the input length and composition, as outlined below:

  • The if block verifies that the length is exactly 12; if it isn't, an error message will be displayed.
  • The else if block checks if the input is numeric; if it's not, an error notification is printed.
  • In the else block, a for loop computes the sum for even and odd index digits (with odd index digits being multiplied by 3), which are then added to the variable s.
  • Finally, the remainder is calculated and adjusted based on whether it equals 10; if true, a 0 is appended to n, or else, the calculated value is used.

You might be interested in
An AM radio transmitter operating at 3.9 MHz is modulated by frequencies up to 4 kHz. What are the maximum upper and lower side
Mrrafil [253]

Answer:

Total bandwidth: 8 kHz

Explanation:

Data provided:

Transmitter frequency: 3.9 MHz

Modulation up to: 4 kHz

Solution:

For the upper side frequencies:

Upper side frequencies = 3.9 × 10^{6} + 4 × 10³

Upper side frequencies = 3.904 MHz

For the lower side frequencies:

Lower side frequencies = 3.9 × 10^{6} - 4 × 10³

Lower side frequencies = 3.896 MHz

Consequently, the total bandwidth is computed as:

Total bandwidth = upper side frequencies - lower side frequencies

Total bandwidth = 8 kHz

6 0
19 days ago
Effects of biological hazards are widespread. Select the answer options which describe potential effects of coming into contact
pantera1 [220]

Answer:

- Allergic Responses

- Events Posing Life Threats

Explanation:

Biological hazards can originate from a variety of sources such as bacteria, viruses, insects, plants, birds, animals, and humans. These can lead to numerous health issues, which may range from skin allergies and irritations to infections (like tuberculosis or AIDS) and even cancer.

7 0
27 days ago
A hydrogen-filled balloon to be used in high altitude atmosphere studies will eventually be 100 ft in diameter. At 150,000 ft, t
mote1985 [204]

Answer:

The calculated result is 11.7 ft

Explanation:

You can apply the combined gas law, which incorporates Boyle's law, Charles's law, and Gay-Lussac's Law, because hydrogen demonstrates ideal gas behavior under these specific conditions.

\frac{p_1 V_1}{T_1} = \frac{p_2 V_2}{T_2}

where the subscripts indicate "p" for pressure, "V" for volume, and "T" for temperature (in Kelvin) at varying moments. Let's denote t_1 as the balloon at 150,000 ft so

p_1 = 0.14 \ lb/in^2

V_1 = \frac{4}{3} \pi R_1^3 = 523598.77 \ ft^3

and T_1 = -67^\circ F = 218.15\ K.

Then t_2 represents the point at which the balloon is on the ground.

p_2 = 14.7 \ lb/in^2 and T_2 = 68^\circ F = 293.15\ K.

Based on the first equation

V_2 = \frac{p_1 V_1 T_2}{T_1 p_2}, we find

V_2 = 6701.07 ft^3 and consequently the radius turns out to be

R_2 = \sqrt[3]{\frac{3 V_2}{4 \pi}} = 11.7 \ ft.

5 0
5 days ago
The uniform dresser has a weight of 90 lb and rests on a tile floor for which the coefficient of static friction is 0.25. If the
Kisachek [217]

Answer:

a) F = 736.065\,lbf, b) \mu_{k} = 0.15

Explanation:

a) The uniform dresser can be modeled using specific equilibrium equations:

\Sigma F_{x} = F - \mu_{k}\cdot N = 0

\Sigma F_{y} = N-m\cdot g=0

Following some algebraic manipulations, the formulated equation is derived:

F = \mu_{k}\cdot m \cdot g

F = (0.25)\cdot (90\,lbm)\cdot (32.714\,\frac{ft}{s^{2}} )

F = 22.5\,lbf

b) Similarly, the man can be represented by a set of equilibrium equations:

\Sigma F_{x} = -F + \mu_{k}\cdot N = 0

\Sigma F_{y} = N-m\cdot g=0

After some algebraic changes, the expression for the coefficient of static friction comes out as:

\mu_{k} = \frac{F}{m\cdot g}

\mu_{k} = \frac{22.5\,lbf}{150\,lbf}

\mu_{k} = 0.15

3 0
7 days ago
An insulated box containing helium gas falls from a balloon 4.5 km above the earth's surface. calculate the temperature rise in
iogann1982 [279]
The increase in temperature of the helium gas is calculated to be 14.25 K. The helium is located in an insulated box that falls from a height of 4.5 km. As it descends, the potential energy is transformed into internal energy of the helium gas. The equation for temperature change can be expressed as: 10 x 4.5 = 3.15 x ΔT, yielding a temperature increase of ΔT = 14.25 K.
6 0
2 days ago
Other questions:
  • 1. You do not need to remove the lead weights inside tires before recycling them.
    8·1 answer
  • A shopaholic has to buy a pair of jeans , a pair of shoes l,a skirt and a top with budgeted dollar.Given the quantity of each pr
    7·1 answer
  • Two streams flow into a 500.0-gallon tank. The first stream is 10.0 wt % ethanol and 90.0 wt% hexane (mixture density is rho1 0.
    15·1 answer
  • . Were you able to observe ???? = 0 in the circuit you constructed during lab? Why or why not? Hint: What value of resistance wo
    6·1 answer
  • Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per li
    15·1 answer
  • 6. You are evaluating flow through an airway. The current flow rate is 10 liters per minute with a fixed driving pressure (P1) o
    5·1 answer
  • Soap is a very interesting chemical. We even discussed it on the discussion board. How does it work, exactly?
    7·1 answer
  • A cylinder in space is of uniform temperature and dissipates 100 Watts. The cylinder diameter is 3" and its height is 12". Assum
    15·1 answer
  • The electrical panel schedules are located on EWR Plan number ___.
    13·1 answer
  • A center-point bending test was performed on a 2 in. x d in. wood lumber according to ASTM D198 procedure with a span of 4 ft an
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!