蓝桥杯十一届python 跑步锻炼

python 专栏收录该内容
2 篇文章 0 订阅

题目描述:
      小蓝每天都锻炼身体。正常情况下,小蓝每天跑1千米。如果某天是周一或者月初(1日),为了激励自己,小蓝要跑2千米。如果同时是周一或月初,小蓝也是跑2千米。
     小蓝跑步已经坚持了很长时间,从2000年1月1日周六(含)到2020年10月1日周四(含)。请问这段时间小蓝总共跑步多少千米?
答案提交
       这是一道结果填空的题,你只需要算出结果后提交即可。本题的结果为一个整数,在提交答案时只填写这个整数,填写多余的内容将无法得分。

思路:模拟,即一天一天计算,如果当天是1号或者周一,跑步千米数+2,否则只加1
 

 

# week=6
# run=0
# for i in range(2000,2021):
#     for mouth in range(1,13):
#         if i == 2020 and mouth in [10,11,12] :
#             break
#         if mouth==2 and (i%400==0 or (i%4==0 and i%100!=0)):
#             day=29
#         elif mouth in [1,3,5,7,8,10,12]:
#             day=31
#         elif mouth in [4,6,9,11]:
#             day=30
#         else:day=28
#         for k in range(1,day+1):
#             if k==1 or week==1:
#                 run+=2
#             else:run+=1
#             week+=1
#             if week==8:
#                 week=1
#
# print(run)

我在2020年9 月30号停止,结果是8877。加上十月一号的的两天,答案是8879.

由于初学,所以跳出循环那里写的不太好。

  • 1
    点赞
  • 3
    评论
  • 1
    收藏
  • 打赏
    打赏
  • 扫一扫,分享海报

评论 3 您还未登录,请先 登录 后发表或查看评论
<p><strong>课程介绍</strong></p> <ol class="ol-list" style="box-sizing: border-box; margin: 0.8em 0px; padding-left: 30px; position: relative; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px;" start=""> <li class="md-list-item md-focus-container" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p md-focus" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain md-expand" style="box-sizing: border-box;">课程对象:编程小白,想通过学习编程改变自己生活或者工作的(如果有其他的语言的基础,可以绕过)</span></p> </li> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">课程内容:介绍编程基本概念,变量、函数、基本数据结构</span></p> </li> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">课前目标:培养基本的编程概念,为之后高级语言特性和自主学习做准备</span></p> </li> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">课前要求:会使用计算机基本操作,有时间、有耐性(有好奇心)</span></p> </li> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">学习方法:简单编写或者抄写程序开始;尝试完成课后小问题;积极思考和提问</span></p> <blockquote style="box-sizing: border-box; margin: 1rem 0px; border-left-width: 4px; border-left-color: #dfe2e5; padding: 0px 15px; color: #777777;"> <p class="md-end-block md-p md-focus" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px; white-space: pre-wrap; position: relative;"><span class="md-plain md-expand" style="box-sizing: border-box;">不介绍高级特性,高级特性有其他的课程,高级特性需要了解除语言意外更多知识</span></p> </blockquote> </li> </ol> <p><strong>Python 特点</strong></p> <ol class="ol-list" style="box-sizing: border-box; margin: 0.8em 0px; padding-left: 30px; position: relative; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px;" start=""> <li class="md-list-item md-focus-container" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p md-focus" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain md-expand" style="box-sizing: border-box;">特点:简单易用;适合初次接触编程学习使用。</span></p> </li> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">社区活跃,各种库丰富;</span></p> </li> <li class="md-list-item md-focus-container" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p md-focus" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain md-expand" style="box-sizing: border-box;">可移植性好;可在不同平台运行</span></p> </li> </ol> <p><strong>课程大纲</strong></p> <ol class="ol-list" style="box-sizing: border-box; margin: 0.8em 0px; padding-left: 30px; position: relative; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px;" start=""> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">课程介绍</span></p> </li> </ol> <blockquote style="box-sizing: border-box; margin: 0.8em 0px; border-left-width: 4px; border-left-color: #dfe2e5; padding: 0px 15px; color: #777777; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">课程的对象、学习方法,python介绍</span></p> </blockquote> <ol class="ol-list" style="box-sizing: border-box; margin: 0.8em 0px; padding-left: 30px; position: relative; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px;" start="2"> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">开发环境搭建</span></p> </li> </ol> <blockquote style="box-sizing: border-box; margin: 0.8em 0px; border-left-width: 4px; border-left-color: #dfe2e5; padding: 0px 15px; color: #777777; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">SDK 安装和IDE的安装,输出hello world</span></p> </blockquote> <ol class="ol-list" style="box-sizing: border-box; margin: 0.8em 0px; padding-left: 30px; position: relative; color: #333333; font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px;" start="3"> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">基本数据类型和变量</span></p> <blockquote style="box-sizing: border-box; margin: 1rem 0px; border-left-width: 4px; border-left-color: #dfe2e5; padding: 0px 15px; color: #777777;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">掌握什么是变量?什么是数据类型</span></p> </blockquote> </li> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">字符串和编码</span></p> <blockquote style="box-sizing: border-box; margin: 1rem 0px; border-left-width: 4px; border-left-color: #dfe2e5; padding: 0px 15px; color: #777777;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">通过字符串,了解编码知识</span></p> </blockquote> </li> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">判断和循环</span></p> <blockquote style="box-sizing: border-box; margin: 1rem 0px; border-left-width: 4px; border-left-color: #dfe2e5; padding: 0px 15px; color: #777777;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">掌握基本的编程结构,判断和循环</span></p> </blockquote> </li> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">简单数据结构 list tuple dict set</span></p> <blockquote style="box-sizing: border-box; margin: 1rem 0px; border-left-width: 4px; border-left-color: #dfe2e5; padding: 0px 15px; color: #777777;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">掌握常用简单的数据结构的基本操作</span></p> </blockquote> </li> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">函数的定义和调用</span></p> <blockquote style="box-sizing: border-box; margin: 1rem 0px; border-left-width: 4px; border-left-color: #dfe2e5; padding: 0px 15px; color: #777777;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">掌握函数概念、自定义函数、函数调用</span></p> </blockquote> </li> <li class="md-list-item" style="box-sizing: border-box; margin: 0px; position: relative;"> <p class="md-end-block md-p" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px 0px 0.5rem; white-space: pre-wrap; position: relative;"><span class="md-plain" style="box-sizing: border-box;">函数参数的更多特性</span></p> <blockquote style="box-sizing: border-box; margin: 1rem 0px; border-left-width: 4px; border-left-color: #dfe2e5; padding: 0px 15px; color: #777777;"> <p class="md-end-block md-p md-focus" style="box-sizing: border-box; line-height: inherit; orphans: 4; margin: 0px; white-space: pre-wrap; position: relative;"><span class="md-plain md-expand" style="box-sizing: border-box;">掌握函数更多关于参数的语法,默认参数、可变参数、关键字参数等等</span></p> </blockquote> </li> </ol>
©️2022 CSDN 皮肤主题:深蓝海洋 设计师:CSDN官方博客 返回首页

打赏作者

念兹在兹°

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值