04 2020 档案
判断素数
摘要:一开始我的prime函数是这样的:, 后来我是这样的:。 由于 “ return True " 缩进的不同而导致前者总是输出合数。 结论:函数运行的最终要得到一个值或者”True“ 或”False“。
阅读全文
余初闻回文数,初试函数解,竟成!(指出前n个回文素数)
摘要:from math import sqrt def huiwen(num): temp=num total=0 while temp>0: total=total * 10+temp % 10 temp//=10 if num==total: return num def prime(num): f
阅读全文
经典题:*年*月*日是第几天
摘要:year=input()month=input()day=input()days = int(day)_30_month = {4, 6, 9, 11}_31_month = {1, 3, 5, 7, 8, 10, 12}if (int(year)%4==0 and int(year)%100!=0
阅读全文
验证码的校验
摘要:n=input()m=list(str(n))if (m[0]=='Q' or m[0]=='q'): if (m[1]=='s' or m[1]=='S'): if (m[2]=='2'): if (m[3]=='X' or m[3]=='x'): print('验证码正确') else: pri
阅读全文