在CSDN上补充前几期的内容
第1关:空格分隔格式化输出
# 实验要求
# 在三行中分别输入当前的年、月、日的整数值,按要求完成输出。
# 1 输出年月日,空格分隔,格式:2020 09 16# 测试数据
# 输入(>>>开头的行表示输入数据)
# >>>2021
# >>>04
# >>>26# 输出
# 2021 04 26# 以下为代码区# =======================================================
year = input() # 输入当前年
month = input() # 输入当前月
date = input() # 输入当前日
# =======================================================
# 此处去掉注释符号“#”并补充你的代码
print(f"{year} {month} {date}")
# =======================================================
第2关:多对象的分隔符号格式化输出
# 实验要求
# 在三行中分别输入当前的年、月、日的整数值,按要求完成输出。# 2 输出年-月-日,连字符“-”分隔,格式:2020-09-16
# 3 输出年/月/日,斜线“/”分隔,格式:2020/09/16
# 4 输出月,日,年,逗号“,”分隔,格式:09,16,2020# 测试数据
# 输入(>>>开头的行表示输入数据)
# >>>2021
# >>>04
# >>>26# 输出
# 2021-04-26
# 2021/04/26
# 04,26,2021# 以下为代码区# =======================================================
year = input() # 输入当前年
month = input() # 输入当前月
date = input() # 输入当前日
# =======================================================
# 此处去掉注释符号“#”并补充你的代码
print(f"{year}-{month}-{date}")
print(f"{year}/{month}/{date}")
print(f"{month},{date},{year}")
# =======================================================
第3关:format方式格式化输出
# 实验要求
# 在三行中分别输入当前的年、月、日的整数值,按要求完成输出。
# 5 用str.format()格式输出,格式:2020 年09 月16 日# 测试数据
# 输入(>>>开头的行表示输入数据)
# >>>2021
# >>>04
# >>>26# 输出
# 2021年04月26日
# 以下为代码区# =======================================================
year = input() # 输入当前年
month = input() # 输入当前月
date = input() # 输入当前日
# =======================================================
# 此处去掉注释符号“#”并补充你的代码
print(f"{year}年{month}月{date}日")
# =======================================================
第4关:字符串拼接方式格式化输出
# 实验要求
# 在三行中分别输入当前的年、月、日的整数值,按要求完成输出。
# 6 用字符串拼接方法输出,格式:2020 年09 月16 日# 测试数据
# 输入(>>>开头的行表示输入数据)
# >>>2021
# >>>04
# >>>26# 输出
# 2021年04月26日
# 以下为代码区# =======================================================
year = input() # 输入当前年
month = input() # 输入当前月
date = input() # 输入当前日
# =======================================================
# 此处去掉注释符号“#”并补充你的代码
print(f"{year}年{month}月{date}日")
# =======================================================