y=input("Please enter the year:")
if y%4==0
and
y%100!=0
or
y%400==0:
print y,"
是闰年
"
else:
print y,"
不是闰年
"
3
、
输入一个学生的成绩,
如果是
90
分以上,
打印出
“
A
”
的评语;
80
分以上的,
打印出
“
B
”
;
70
分以上的,
打印出
“
C
”
;
60
分以上的,打印出“
D
”;不及格的打印出”
E
”。
print "This is a procedure which can print the mark related to your score. The range of your score is 0~100."
x=input("Please enter your score:")
while True:
if x<0 or x>100:
x=input("Wrong input, the range is 0~100. Please enter again:")
if 90
print "A"
break
if 80
print "B"
break
if 70
print "C"
break
if 60
print "D"
break
if 0<=x<60:
print "E"
break
4
、
通过
InputBox
函数任意输入三条边长,经过简单的计算后,判断三条边长能否构成三角形,并在文本框中显示结果。
【提示】构成三角形,必须保证任意两边的和大于第三边
a=input("Please input the length of a:")
b=input("Please input the length of b:")
c=input("Please input the length of c:")