while 1: s = input('请填入一个年份:') s = int(s) year = False if s % 100 == 0 and s % 400 == 0: year = True elif s % 100 != 0 and s % 4 == 0: year = True if year: print('闰年') else: print('平年')
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _03判断闰年 { class Program { static void Main(string[] args) { //举例:写一个方法,判断一个年份是否是润年. bool b = IsRun(2000); Console.WriteLine(
解决:Python如何判断字符串中是否有中文 In [240]: s Out[240]: '你好aa' In [241]: for i in s: ...: if u'\u4e00' <= i <= u'\u9fff': ...: print("yes") ...: else: ...: print("no") yes yes no no