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
stellarik [79]
3 years ago
9

(Business: check ISBN-10) 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 convention. Write a program that prompts the user to enter the first 9 digits as a string and displays the 10-digit ISBN (including leading zeros). Your program should read the input as a string. Here are sample runs: Enter the first 9 digits of an ISBN-10 as a string:013601267 The ISBN-10 number is 0136012671 Enter the first 9 digits of an ISBN-10 as a string:013031997 The ISBN-10 number is 013031997X
Computers and Technology
1 answer:
Aneli [31]3 years ago
7 0

Answer:

 The solution code is written in Python 3

  1. digits = input("Enter 9 digits: ")
  2. multiplier = 1
  3. total = 0
  4. for x in digits:
  5.    total += int(x) * multiplier  
  6.    multiplier += 1
  7. checksum = total % 11  
  8. if(checksum == 10):
  9.    print(digits + "X")
  10. else:
  11.    print(digits + str(checksum))

Explanation:

Firstly, use input function to get user input for 9 digits (Line 1)

Next we can use a for-loop to estimate the summation (d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5+ d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) ( Line 6-8)

Then only apply % operator to get the remainder of total and get the checksum (Line 10)

Next create if and else statement to print the digits string joined with X if checksum is 10 else join digits string with checksum value (Line 12 -15)

You might be interested in
When the wires are connected to the terminals of the battery, what causes electric current in the circuit?
Anastaziya [24]

Answer: The battery provides a voltage between terminals. The electric field set up in a wire connected to the battery terminals causes the current to flow, which occurs when the current has a complete conducting path from one terminal of the batter to the other. This is called a circuit.

Explanation:

4 0
3 years ago
Which type of test is run in non-production subnets where you’ve configured a duplicate of the production environment?
LenKa [72]

Answer:

Laboratory Test

Explanation:

  • The lab test runs on a non-product subnet, where it configures duplicates of the production environment. It mirrors the entire system, including the firewall.
  • These test-runs test anything that interferes with the production environment.
  • so correct answer is Laboratory Test

3 0
3 years ago
What was the key design change for hfc-134a a/c systems versus CFC 12 a/c systems
babunello [35]
Reduction in the contribution to ozone depletion and reduced Global Warming Potential - <span>Both gases CFC and HFC gases are used as refrigerants in car air conditioning systems (A/C-systems). However, </span><span>hfc-134a a/c systems were built to be environment friendly and reduced the Global Warming Potential (GWP) by more than 80%.</span>
8 0
3 years ago
Why isn't 802.1X a good choice for home based wireless networks
Sholpan [36]
It can possibly cause an issue with the authenticator's end. Its capacity has a limited memory capacity and has the minimal processing power. Most of the process will be at the supplicant and authentication servers. However, the 802.1X has a better security compared to the WEP.
6 0
3 years ago
Which is an example of a local government enforcing a national law?
Gekata [30.6K]
I would say A, I had originally thought D, but you're able to drop out. 
3 0
3 years ago
Read 2 more answers
Other questions:
  • ​to prevent intrusions, companies install combinations of hardware and software called _____ to keep unauthorized web users from
    9·1 answer
  • What are the disadvantages of a server-based network? -lack of centralized network security - need for a network administrator -
    14·1 answer
  • What is Napoleon's friend's full name? From the Napoleon Dynamite movie.
    9·2 answers
  • How do users log into Windows 8?
    7·1 answer
  • Which of the following is true for an API? I. Allows different devices to connect with each other II. Allows for Interactivity b
    15·1 answer
  • // Exercise 4.16: Mystery.java
    6·1 answer
  • I need help with this question. its in the photo
    10·1 answer
  • What is the other name of iterative staatement ​
    13·1 answer
  • MLB The Show 17, which simulates professional baseball games, and Madden Football, which simulates professional football games,
    5·1 answer
  • What is the main function of the output on a computer or what is it use for? ​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!