Your program never enters the while loop:
a = 53150220288
while a <= 1000000000:
문제
I am trying to write a program that first of all checks if you can get from number a to number b by only swapping 2 digits. My below code is designed to start at 53150220288 and then check if it is possible to reach number 537163806382 by only changing 2 digits. So basically i am trying to only change 2 digits of the number 537163806382 so that the new numbers are multiples of 99. Then output them to a text file. I am writing this program to do it for me but it is actually for a maths competition.
f = open('Blank.txt', 'w')
a = 53150220288
b = 537163806382
b = str(b)
c = 0
while a <= 1000000000:
for i in range(len(b)):
if b[i] == a[i]:
c = c
else:
c = c + 1
if c == 2:
a = str(a)
print(a, file=f)
else:
c = 0
a = int(a)
a = a + 99
f.close()
Problem with the above code is that it outputs absolutely nothing! I don't know why?
해결책
Your program never enters the while loop:
a = 53150220288
while a <= 1000000000:
다른 팁
The obvious reason is that your program doesn't enter the loop.
so do this:
a = 53150220288
while a <= 1000000000: