Home > other >  Python insert position search
Python insert position search

Time:09-24

Friends, please give directions, if you are willing to help me, I am very grateful, I soon in CSDN, also won't stick, please tell me how to knot, knot stick I gave you, thank you

CodePudding user response:

Cannot bear post is probably not a browser, try a different browser

CodePudding user response:

 
Li=[I for I in range (1, 20)]

Def func () :
Num=int (input (' please enter the number:))
If num is not in li:
Print (' Numbers {} is not in the list. The format (num))

Li. Append (num)
Print (' finish the Numbers {} inserted into the list. The format (num))
The index=li. The index (num)
Print (' new insert Numbers {} in the index of the list is: {} '. The format (num, index))
The else:
Print (' Numbers {} in the list. The format (num))
The index=li. The index (num)
Print (' digital {} in the index of the list is: {} '. The format (num, index))
Func ()
Func ()
Input (' process ')

# below is the results
"' please enter the Numbers: 6
Number 6 in the list
The index of the number 6 in the list is: 5
Please enter a number: 25
Number 25 is not in the list
Insert the number 25 completed list
New insert Numbers in the list of 25 indexes are: 19
Can complete the "'


  • Related