python3 练习题100例 (十七)四位车号问题

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__author__ = 'Fan Lijun'

import math

for i in range(1000, 10000):
    n, m = str(math.sqrt(i)).split('.')
    if m == '0' and i//1000 == int(str(i)[1]) and i % 10 == int(str(i)[-2]):
        print(i)

猜你喜欢

转载自blog.csdn.net/daxia5398/article/details/84578916