Skip to content

Commit dbdd78f

Browse files
committed
update
1 parent e42d70a commit dbdd78f

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎part01_basic/variable.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,16 @@
3636

3737
# 获取输入 类型转换
3838
a = int(input('a = '))
39-
b = int(input('b = '))
39+
b = int(input('b = '))
40+
# 格式化输入
41+
print('%d + %d = %d' % (a, b, a + b))
42+
43+
"""
44+
输入年份 如果是闰年输出True 否则输出False
45+
"""
46+
47+
year = int(input('请输入年份: '))
48+
# 如果代码太长写成一行不便于阅读 可以使用\对代码进行折行
49+
is_leap = year % 4 == 0 and year % 100 != 0 or \
50+
year % 400 == 0
51+
print(is_leap)

0 commit comments

Comments
 (0)