- 1
How to delete the digits?
A number 4529, I want to delete 2 digits, and let the result become minimum. For example, 4529-->29, 4529-->52, 29 is minimum, which is what I want.
4 ответов
+ 2
a=int(input())
mins=a%100
while a>9 :
if mins>(a%100) :
mins=a%100
a=a//10
print(mins)
For Input: 12345
Output: 12 because in 12345, 12 is minimum
For input 4528, output is 28
Is this you are looking?
+ 2
mynum = 4529
strmynum = str(mynum)
mylist = []
for x in range(len(strmynum)-1):
mylist.append(int(strmynum[x:x+2]))
print(min(mylist))
0
Does anyone understand what linzuxuan wants? I'm don't understood...
rodwynnejones 's code is best decision