Home > other >  Pta python try to find a test point 1 always pass the evening, ask god for help, and see my where th
Pta python try to find a test point 1 always pass the evening, ask god for help, and see my where th

Time:09-21

 qian=[["] 
"Hou=["]]
Adic={}
For I in range (len (qian) :
=hou adic [qian [I]] [I]
Alist=STR (input ())
N=int (input ())
Z=0
For I in alist:
If I in qian:
Z +=1
If 1 & lt;=n & lt;=z:
Result=[]
For I in range (len (alist) :
If alist [I] in qian:
Result. Append (alist [I])
If len (result)==n:
Q=I
Break
Mubiao=adic [alist [q]]
Count1=0
For j in range (len (alist) :
If alist [: : - 1) [j]==mubiao:
Count1 +=1
If count1==n:
M=j
Break
X=eval (alist [q: len (alist) - m])
Y=0
For I in x:
If isinstance (I, int) :
Y +=1
Print (y)
The else:
Print (0)

CodePudding user response:

Try the following:
To enter a nested list, and then the input layer, digital elements of the layer number,
Input format:
The first line the input list input layer
The output format:
In the number of output elements in the line
Input the sample:
Given a set of input here, for example:
[1, 2, 3, 4, 5, 6], 7], 8]
3
The output sample:
Here is given the corresponding output, for example:
2

CodePudding user response:

 qian=[["] 
"Hou=["]]
Adic={}
For I in range (len (qian) :
=hou adic [qian [I]] [I]
Alist=STR (input (' array '))
N=int (input (' layer? '))
Z=0
For I in alist:
If I in qian:
Z +=1
If 1 & lt;=n & lt;=z:
Result=[]
For I in range (len (alist) :
If alist [I] in qian:
Result. Append (alist [I])
If len (result)==n:
Q=I
Break
Mubiao=adic [alist [q]]
Count1=0
For j in range (len (alist) :
If alist [: : - 1) [j]==mubiao:
Count1 +=1
If count1==n:
M=j
Break
X=eval (alist [q: len (alist) - m])
Y=0
For I in x:
If isinstance (I, int) :
Y +=1
Print (y)
The else:
Print (0)


No problem!

CodePudding user response:

Seems to be no problem!
  • Related