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
rodikova [14]
4 years 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:
kondor19780726 [428]4 years ago
4 0

Answer:

Follows are the code to this question:

n=input("Enter the first 12 digits of an ISBN-13 as a string:")#defining a varaible isbn for input value

if len(n)!=12: #use if block to check input value is equal to 12 digits

   print("incorrect input") #print error message

elif n.isdigit()==False: #use else if that check input is equal to digit

   print("incorrect input") #print error message

else:# defining else block

   s=0 #defining integer vaiable s to 0

   for i in range(12):#defining for loop to calculate sum of digit

       if i%2==0: #defining if block to check even value

           s=s+int(n[i])#add even numbers in s vaiable  

       else: #use else block for odd numbers

           s=s+int(n[i])*3 #multiply the digit with 3 and add into s vaiable

   s=s%10#calculate the remainder value  

   s=10-s#subtract the remainder value with 10 and hold its value

   if s==10: #use if to check s variable value equal to 10  

       s=0#use s variable to assign the value 0

   n=n+s.__str__() #u

Output:

please find attached file.

Explanation:In the above Python code, the "n" variable is used for input the number into the string format uses multiple conditional statements for a check input value, which can be defined as follows:

  • In if block, it checks the length isn't equal to 12, if the condition true, it will print an error message.
  • In the else, if the block it checks input value does not digit, if the condition is true, it will print an error message.
  • In the else block, it uses the for loop, in which it calculates the even and odd number sum, and in the odd number, we multiply by 3 then add into s variable.
  • In this, the s variable is used to calculate its remainder and subtract from the value and use the if block to check, its value is not equal to 10 if it's true, it adds 0 into the last of n variable, otherwise, it adds its calculated value.    

You might be interested in
What happens when force is placed on a square/rectangle?
mart [117]

im not sure i need to see a photo and also is this science

7 0
3 years ago
Read 2 more answers
A centrifugal pump is used to extract water from a reservoir at 14,000 gal/min. The pipe connecting the pump inlet to the reserv
Dahasolnce [82]

This question is incomplete, the complete question is;

A centrifugal pump is used to extract water from a reservoir at 14,000 gal/min. The pipe connecting the pump inlet to the reservoir is 12 inches in diameter and is 65 ft long.

The average friction factor in this pipe is 0.018. The pump performance curves indicate that, at this flow rate, the head rise across the pump is 320 ft, the efficiency is 81% and the required NPSH is 25 ft.

Please estimate: The required brake horsepower.

Answer:

The required brake horsepower is 1400.08

Explanation:

Given the data in the question;

Power required to drive the pump can be determined using the formula;

P = r_wQH / η₀(0.745)

given that; centrifugal pump is used to extract water from a reservoir at 14,000 gal/min.

Q = 14,000 gal/min = ( 14,000 × 0.00006309 )m³/sec = 0.883 m³/sec

the head rise across the pump is 320 ft,

H = 320 ft = ( 320 × 0.3048 )m = 97.536 m

the efficiency η₀ = 81% = 0.81

r_w = 9.81 kN/m³

so we substitute our values into the formula

P = [ 9.81 × 0.883 × 97.536 ] / 0.81(0.745)

P = 844.87926528 / 0.60345

P = 1400.08 HP

Therefore, The required brake horsepower is 1400.08

5 0
3 years ago
In pea plants, tall height is dominant over short height. How can two tall plants result in a short offspring.
MatroZZZ [7]
I think if both the parents are heterozygous. Then if you do a punnet square the last box would be tt. There you go!
3 0
3 years ago
Oliver is designing a new children’s slide to increase the speed at which a child can descend. His first design involved steel b
AVprozaik [17]

Answer:

The correct option is;

A) Steel becomes too hot in the Sun and can burn the children

Explanation:

The properties of steel includes;

Low specific heat capacity, high thermal and electrical toughness, high hardness, high tensile strength, high yield strength, appreciable elongation, high fatigue strength, can easily corrode, high malleability and ability to creep

Therefore, due to the low specific heat capacity, which is 0.511 J/(g·°C) and high conductivity of steel which is about 32 W/(m·k), the temperature of the steel can rapidly rise and the hot steel surface can readily conduct the heat, (due to the temperature difference) to other bodies that come in contact

8 0
3 years ago
Transaction are posted into ledger account from a) voucher b) journal book c) bank statement d) none of these
vodomira [7]

Answer:

b) journal book

Explanation:

A ledger is an account for recording balance sheet and income statement transaction entries like cash, investments, inventory and so on.

Before a transaction is posted into the ledger account after an accounting cycle, it is first written in the journal book, before it is then posted in the ledger account. The process of posting refers to the transferring of entries from the journal book to the ledger.

8 0
3 years ago
Other questions:
  • Examining the qualifications of the<br> is one criterion for evaluating information sources.
    9·1 answer
  • What should a technician do before entering a confined space? Question 1 options: A) Post another worker outside the confined sp
    11·1 answer
  • A mass of 12 kg saturated refrigerant-134a vapor is contained in a piston-cylinder device at 240 kPa. Now 300 kJ of heat is tran
    8·1 answer
  • A simple undamped spring-mass system is set into motion from rest by giving it an initial velocity of 100 mm/s. It oscillates wi
    11·1 answer
  • ____________________________________________ help scientists understand processes in the natural world by providing simpler repr
    11·2 answers
  • Were you surprised by the “pie data”? Is it true for you, your family, and your friends? Why or why not?
    13·2 answers
  • PLZZ HELP WILL GIVE BRAILYEST PLZZ HELP
    9·2 answers
  • Steven is starting a project that requires a specialized, experienced contractor. Which selection process is the most suitable f
    11·1 answer
  • Name some of the traits that Darwin studied in the Galapagos finches.
    8·2 answers
  • How long...you...novels? A. Have/write B. Do/write C. Have/written D. Did/go
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!