Home > other >  A beginner who not jing, why didn't run results?? Crab crab you requested
A beginner who not jing, why didn't run results?? Crab crab you requested

Time:01-30

CodePudding user response:

Ask questions, post your code, debugging and running, so that others the code description is clear, don't let somebody else who guess, don't have enough energy. This is how the basic humility.

CodePudding user response:

Thank you for your points out problem, later will note, I hope you can to let, the following correction:
Title:
A valid id number by 17 area, date number and sequence number 1 - check code, check code calculation rules are as follows:
First of weighted summation, the first 17 digits weight distribution as: {7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2}; Is then calculated and on 11 modulus values of Z; Finally according to the following corresponding Z value to check code M value:
Z: 0 1 2 3 4 5 6 7 8 9 10
M: 1 0 X 9 8 7 June 5 4 3 2
Now given some id card number. Please verify the validity of the check code, and there is something wrong with the output of number,
Input format:
4
320124198808240056
12010 x198901011234
110108196711301866
37070419881216001 x
Enter the first line gives the positive integer N (100) or less is the number of input id number, then N rows, each row is given a 18 id number,
The output format:
12010 x198901011234
110108196711301866
37070419881216001 x
There is something wrong with the line in accordance with the order of the input output 1 id number, there is no inspection before 17 is reasonable, only check whether 17 before All Numbers and the last one check code to calculate accurately, if All the number, the output All passed,
Code:
Z=#,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2 [7] to establish the weight list
M=[' 1 ', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'] # set up corresponding weight check code list
N=eval (input (), the number of input id #
A=[] # set up an empty list
C=[] # set up an empty list
For I in range (0, n) : # traversal from 0 to n
A.a ppend (input ()) # can enter n lines
For j in a: # from out one by one element in a list (each id number)
J=STR (j) # will each id number into a string
Str1=STR (j) [: 17] # remove before each of the id card number 17
If str1. Isdigit () is True: # 17 before judging whether all digital
C.a. ppend (j) # if all Numbers will be the id card number added to the c
For p in the range (len (c)) : # traverse length c list
B=c [p] # make b is equal to in turn after first screening each id number
B=b # 17] [: take out before each of the id card number 17
W=0
In the range for q (len (b)) : the length of each id # traversal
W +=int * int [q] (b) (z) [q] # weighted summation of 17 digits before
Y=w % 11 # for income and weighted modulus
B1=b] [- 1: - 2: - 1 # to b1 is equal to every id of the last
If b1==m [y] : # last thought is equal to the corresponding id check code
Print (b) b # output

CodePudding user response:

Check the indentation,

CodePudding user response:

And input always return the STR, don't have to STR
  • Related