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
Alborosie
4 years ago
10

Pythonpython An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. The last digit, d10,

is a checksum, which is calculated from the other nine digits using the following formula: (d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11 If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros).
Computers and Technology
1 answer:
Nataly_w [17]4 years ago
4 0

Answer:

Written in Python

print("Enter the first 9 digits: ")

d1 = int(input())

d2 = int(input())

d3 = int(input())

d4 = int(input())

d5 = int(input())

d6 = int(input())

d7 = int(input())

d8 = int(input())

d9 = int(input())

d10 = (d1 * 1+ d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9)%11

if d10 == 10:

                                   print(str(d1)+str(d2)+str(d3)+str(d4)+str(d5)+str(d6)+str(d7)+str(d8)+str(d9)+"X")

else:

                                   print(str(d1)+str(d2)+str(d3)+str(d4)+str(d5)+str(d6)+str(d7)+str(d8)+str(d9)+str(d10))

                                   

Explanation:

This line prompts user for input

print("Enter the first 9 digits: ")

The next 9 line gets the first 9 ISBN digits

d1 = int(input())

d2 = int(input())

d3 = int(input())

d4 = int(input())

d5 = int(input())

d6 = int(input())

d7 = int(input())

d8 = int(input())

d9 = int(input())

This calculates the checksum

d10 = (d1 * 1+ d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9)%11

The if condition prints the ISBN number by replacing the last digit with X if the checksum is 10 else it appends the original digits

<em>if d10 == 10:</em>

<em>                                    print(str(d1)+str(d2)+str(d3)+str(d4)+str(d5)+str(d6)+str(d7)+str(d8)+str(d9)+"X")</em>

<em>else:</em>

<em>                                    print(str(d1)+str(d2)+str(d3)+str(d4)+str(d5)+str(d6)+str(d7)+str(d8)+str(d9)+str(d10))</em>

<em />

You might be interested in
What kind of keybord is tis ned help pleese I don't no wat itis​
Murrr4er [49]

Answer:

judging by the logo at the top it's a hyperx keyboard and looks to be the alloy core rgb... hope this helps!

8 0
3 years ago
Read 2 more answers
Select the focus questions that emphasizes what is more important: (Select all that apply)
mafiozo [28]

Answer:

The selected answers are;

a. What needs to be brought into view in the foreground?

b. What needs to be bigger and more prominent?

c. What needs to be relegated to the background?

Explanation:

4 0
3 years ago
Next, Kim decides to include a diagram of a frog’s life cycle in her presentation. She wants to use an image that is part of a p
kap26 [50]

Answer:

B, C, D, and F are correct answers

Explanation:

On edg

8 0
4 years ago
Read 2 more answers
How can you tell that a spreadsheet was saved as a 2007 Excel file?
jek_recluse [69]
The file name will end in .exl, hope this helps
3 0
3 years ago
Jasmine wants electrical current to be able to pass through a certain switch on a circuit board that she is designing. What stat
Alenkinab [10]
State 1 I don’t know if it’s right tho
3 0
3 years ago
Other questions:
  • Which of the following is a type of monitor port?
    10·1 answer
  • He following is a string of ASCII characters whose bit patterns have been converted into hexadecimal for compactness: 4A EF 68 6
    12·1 answer
  • ________ is the application of statistical techniques to find patterns and relationships among data for classification and predi
    14·1 answer
  • How many values will the user submit each time this form is used? Color: RedBlueGreen Quantity:
    10·1 answer
  • FILL IN THE BLANK.
    15·1 answer
  • A newly opened law firm in Kirkland decides to create a small website that provides a brief introduction of the firm, its missio
    8·1 answer
  • When two or more tables share the same number of columns, and when their corresponding columns share the same or compatible doma
    12·1 answer
  • How do you change your brainly lvl, it says I'm in collage but I'm in 8th grade :(
    10·2 answers
  • Which is the most correct option regarding subnet masks?
    10·1 answer
  • 1 point
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!