zoukankan      html  css  js  c++  java
  • 20181312 2019-2020-2 《Python程序设计》实验一报告

    20181312 2019-2020-2 《Python程序设计》实验一报告

    课程:《Python程序设计》
    班级:1813
    姓名:谢绎
    学号:20181312
    实验教师:王志强
    实验日期:2020年4月11日
    必修/选修:公选课

    1.实验内容

    • 熟悉Python开发环境;

    • 练习Python运行、调试技能;

    • 编写程序,练习变量和类型、字符串、对象、缩进和注释等;

    • 掌握git技能

    2.实验过程及结果

    • python开发环境安装

      1. 进入Python官方网站

      1. 点击download下载Python

      1. 我使用的是Windows系统,所以选取Windows版本最新的Python 3.8.2

      1. 安装过程

    • Pycharm安装

      1. 进入Pycharm下载页

      1. 选取Community下载

      2. 安装过程


    • Python的基本运行与调试

      1. IDLE运行

        打开IDLE,输入import this,敲下enter之后可以看到一首小诗

        >>> import this
        The Zen of Python, by Tim Peters
        
        Beautiful is better than ugly.
        Explicit is better than implicit.
        Simple is better than complex.
        Complex is better than complicated.
        Flat is better than nested.
        Sparse is better than dense.
        Readability counts.
        Special cases aren't special enough to break the rules.
        Although practicality beats purity.
        Errors should never pass silently.
        Unless explicitly silenced.
        In the face of ambiguity, refuse the temptation to guess.
        There should be one-- and preferably only one --obvious way to do it.
        Although that way may not be obvious at first unless you're Dutch.
        Now is better than never.
        Although never is often better than *right* now.
        If the implementation is hard to explain, it's a bad idea.
        If the implementation is easy to explain, it may be a good idea.
        Namespaces are one honking great idea -- let's do more of those!
        
      2. Pycharm运行

        新建一个Project,新建一个python脚本,命名为start.py

        输入print("人生苦短,我用python")

        点击右上方绿色三角形运行,可以看到

      3. Pycharm的单步运行与调试

        1. 在代码行序号处设置断点,可以让程序中断在需要的地方,从而方便分析程序。

        2. 点击右上角运行三角按钮右边的虫虫图标,开始调试程序。

        3. 在console中输入、输出,在debugger中查看变量值。

        4. 在这个简单的程序里可以用到的两个调试按钮

          • step over 单步调试。

            若函数A内存在子函数a时,不会进入子函数a内执行单步调试,而是把子函数a当作一个整体,一步执行。

          • step into 单步调试。

            若函数A内存在子函数a时,会进入子函数a内执行单步调试。

    • 编写程序练习变量类型、字符串、对象、缩进和注释等

      变量类型字符串、注释练习

      类与对象练习

    • 掌握Git技能

      Git是一个版本管理工具,学习Git可以参考

      Git安装可以参考@娄老师使用开源中国(码云)托管代码

      在Pycharm中配置Git

      配置完成就可以使用啦

    3. 实验过程中遇到的问题和解决过程

    • 问题1:在使用Git时出现Commit failed

    • 问题1解决方案:将author内容空置即可

    • 问题2:在使用Git时出现push rejected

    • 问题2解决方案:问题的原因是本地仓库与云端仓库差别过大导致,本地仓库的文件无法push。

      1. 打开terminal
      2. 输入git pull
      3. 输入git pull origin master
      4. 输入git pull origin master --allow-unrelated-histories
      5. 重新push,即可发现push成功

    其他(感悟、思考等)

    学习python的路程很漫长,需要不断的投入。

    参考资料

  • 相关阅读:
    Redis-持久化
    Redis-Sort命令
    Redis-ZSet常用命令
    Redis-Hash
    Redis-Set常用命令
    Redis-List常用命令
    Redis-String常用命令
    访问控制
    c++之旅:多态
    c++之旅:类型的强制转换
  • 原文地址:https://www.cnblogs.com/blingblingXY/p/12734676.html
Copyright © 2011-2022 走看看