#-*- coding:utf- -*- ''' Created on -- # 输入年月日,判断为一年的第几天 @author: AdministrInputator ''' def leapYear(year): # 判断平闰年,由于输入年份只有两位数,‘’~‘’转换为2000~,‘’~’‘转换为1970~ == and year % != : return True else: return False def dateJudge(strInput): # which day of the
输入一行字符,判断不同字符的数量, 分别用for循环和while循环完成 for循环 运用了字符串方法, isupper()判断是否为大写字母 islower()判断是否为小写字母 isdigit()判断是否为数字 n = input("输入一行字符:") daxie = 0 xiaoxie = 0 num = 0 other = 0 for data in n: if data.isupper(): daxie += 1 elif data.islower(): xiaoxie +=
编写一个控制台应用程序,可根据输入的月份判断所在季节 代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Lab002 { class Program { static void Main(string[] args) { int i; Console.WriteLine("请输入月份:&q
1)接收输入 check_status() { echo --Check hi_repo status is ok? y or n read var if [ "$var" != "y" ] then echo --input is not 'y' exit fi } 1.编写函数check_status,调用时直接写check_status,不用括号: 2.输入read var, 使用时用$var 3.if判断,可以用!=,注意if []的空格: 2)删除空行 #
前两天公司有一个功能需求,客户给出几天的工作时间和休息,然后顾客的访问时间必须要在工作时间之内和休息时间之外,所以要求做一下判断.本来以为这个没什么,谁知道客户提供的工作时间段和休息时间段不定,给出的又不是日期格式,是串联后的文本格式,如下格式,想了一下,只能下个函数来解决,分享给其他人看看 GO /****** Object: UserDefinedFunction [dbo].[CheckDate] ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTI