year = int(input(“请输入年份:”))
if year % 4000:
print(“该年份是闰年”)
elif year % 40 and year % 100!=0:
print(“该年份是闰年”)
else:
print(“年份不是闰年”)
import random;
ret = random.randrange(10, 99)
print(“随机两位整数:random.randint(10,99)=”,ret)
ret1 = ret % 10
ret2 = ret // 10
ret3 = ret1 * 10 + ret2
num = int(input(“请输入两位数字:”))
num1 = num % 10
num2 = num // 10
if num == ret:
print(“赢得10000美金”)
elif num == ret3:
print(“赢得3000美金”)
elif num1 == ret1 or num1 == ret2 or num2 == ret1 or num2 == ret2:
print(“赢得1000美金”)
a = float(input(“请输入数字:”))
b = float(input(“请输入数字:”))
c = float(input(“请输入数字:”))
d = float(input(“请输入数字:”))
e = float(input(“请输入数字:”))
f = float(input(“请输入数字:”))
x = (e * d - b * f) / (a * d - b * c)
y = (a * f - e * c) / (a * d - b * c)
if (a * d - b * c) == 0:
print(“The equation has no solution”)
else:
print(“x的值为:”,x)
print(“y的值为:”,y)
day = int(input(“输入今天是一周内哪一天的数字(星期天是0,星期一是1…星期六是6):”))
day2 = int(input(“输入今天之后到未来某天的天数:”))
a = (day1 + day2) % 7
if a == 0:
print(“未来这天是星期天”)
elif a == 1:
print(“未来这天是星期一”)
elif a == 2:
print(“未来这天是星期二”)
elif a == 3:
print(“未来这天是星期三”)
elif a == 4:
print(“未来这天是星期四”)
elif a == 5:
print(“未来这天是星期五”)
elif a == 6:
print(“未来这天是星期六”)
weight,money = map(int,input(“输入第一个包装的重量及价钱”).split())
weight1,money1 = map(int,input(“输入第二个包装的重量及价钱”).split())
if (weight / money) > (weight1 / money1):
print(“第一个包装划算”)
elif (weight / money) < (weight1 / money1):
print(“第二个包装划算”)
else:
print(“一样划算”)
num = int(input(“输入一个整数:”))
print(“这个数是否能被5和6都整除?”)
if num % 5 == 0 and num % 6 == 0:
print(“True”)
else:
print(“Flase”)
print("这个数是否能被5或6整除? ")
if num % 5 == 0 or num % 6 == 0:
print(“True”)
else:
print(“Flase”)
print(“这个数是否能被5或6整除? 但不是同时被整除”)
if num % 5 == 0 and num % 6 != 0 or num % 5 != 0 or num % 6 == 0:
print(“True”)
else:
print(“Flase”)
import random
a = int(input(“剪刀(0),石头(1),布(2):”))
i = random.randrange(0, 3)
print(“随机生成:”,i)
if i == a:
print(“平局”)
elif i - a == 1:
print(“你输了”)
elif a - i == 1 or i - a == 2:
print(“你赢了”)
rate = float(input(“美元和人民币的汇率:”))
a = int(input(“输入0表示将美元转换为人民币,输入1表示将人民币转为美元:”))
num = float(input(“输入数目”))
if a == 0:
rmb = num * rate
print(“
e
l
i
f
a
=
=
1
:
m
y
=
n
u
m
/
r
a
t
e
p
r
i
n
t
(
"
%s是%s人民币"%(num,rmb)) elif a == 1: my = num / rate print("%s人民币是%s
elifa==1:my=num/rateprint("”%(num,my))
import math
(a,b,c) = eval(input(“输入三角形的三条边:”))
if a + b > c and b + c > a and a + c > b:
print(“周长为%s”%(a+b+c))
else:
print(“非法”)
year = int(input(“输入一个年份:”))
month = int(input(“输入一个月份:”))
day = int(input(“输入一月中的某一天:1-31:”))
if month == 1:
year = year - 1
month = 13
elif month == 2:
year = year - 1
month = 14
j = year // 100
k = year % 100
h = (day + abs((26 * (month + 1))/10) + k + abs(k / 4) + abs(j / 4) + 5 * j) % 7
print("这周的星期%s "%h)
import math
(x , y) = eval(input(“输入一个坐标:”))
if math.sqrt(x2 + y2) < 10 or math.sqrt(x2 + y2) == 10:
print(“点(%s,%s)在这个圆内”%(x , y))
elif math.sqrt(x2 + y2) > 10:
print(“点(%s,%s)不在这个圆内”%(x , y))
import math
(x , y) = eval(input(“输入一个坐标:”))
if x <= 5 and y <= 2.5:
print(“点(%s,%s)在矩形内”%(x,y))
else:
print(“点(%s,%s)不在矩形内”%(x,y))
import math
num = int(input(“输入一个三位整数:”))
n = num // 100
u = num % 100
m = u % 10
if n == m :
print(“该数为回文数”)
else:
print(“该数不为回文数”)