20191206陈发强 实验一python程序设计入门

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

课程:《Python程序设计》
班级: 1912
姓名: 陈发强
学号:20191206
实验教师:王志强
实验日期:2020年4月15日
必修/选修: 公选课

1.实验内容

  • 熟悉Python开发环境;
  • 练习Python运行、调试技能;
  • 编写程序,练习变量和类型、字符串、对象、缩进和注释等;
  • 掌握git技能

2. 实验过程及结果

  • 安装配置熟悉Pycharm开发环境;













增加python解释器






  • 掌握基本的Python运行和调试技能;

添加断点

启动debug


  • show execution point (F10) 显示当前所有断点
  • step over(F8) 单步调试。
  • step into(F7) 单步调试。若函数A内存在子函数a时,会进入子函数a内执行单步调试。
  • step into my code(Alt + Shift +F7) 执行下一行但忽略libraries(导入库的语句)
  • force step into(Alt + Shift +F7) 执行下一行忽略lib和构造对象等
  • step out(Shift+F8)当目前执行在子函数a中时,选择该调试操作可以直接跳出子函数a,而不用继续执行子函数a中的剩余代码。并返回上一层函数。
  • run to cursor(Alt +F9) 直接跳到下一个断点

  • 掌握基本的Python编程技能。

      '''注释用的  #  和markdown的 一级标题的符号重复了。。。
      就用 多行字符串 代替一下注释吧。。    '''
      #文本进度条,在终端里运行的话可以显示 程序的进度,也就是比如,游戏加载了多少之类的
      import time
      scale = 50
      print('{:-^60}'.format('执行开始'))
      start = time.perf_counter()
      for i in range(scale+1):
          a = '*'*i
          b = '.'*(scale-i)
          c = (i/scale)*100
          dur = time.perf_counter() - start
          print('\r{:^3.0f}%[{}->{}]{:2f}s'.format(c,a,b,dur),end='')
          time.sleep(0.05)
      print('\n{:-^60}'.format('执行结束'))
    


class human:
    name = "姓名"
    def __init__(self):
        global name
        name = input("请输入姓名:")

    def run(self):
        print("{} is running happily".format(name))
    def eat(self):
        print("{} is going to eat something delicious".format(name))
    

class chinese(human):
    __secret= "国家机密"
    def speak(self):
        print("{} is speaking chinese".format(name))
    def write(self):
        print("{} is writing chinese charaters".format(name))


class besti(chinese):
    __address__ = "丰台区富丰路7号"
    def principle(self):
        print("{} is loyal,studious,rigorous and disciplined".format(name))


student = besti()
student.run()
student.speak()
student.principle()
try:    
    print(student.__secret)
except:
    print("!!secret不可访问!!")

print(student.__address__)
  • 程序代码托管到码云




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

  • 问题1:pycharm 的Git 配置,账号登录,创建Git库,当时都不知道怎么办
  • 问题1解决方案:百度一下,我就知道了,也是博客园里的一篇博客,教的还挺详细的。
  • 那篇博客

其他(感悟、思考等)

感觉学计算机,搜索能力还是很重要的,毕竟计算机已经发展几十年了,我现在所遇到的问题,估计早就有人解决了
很多资料啊、信息啊、知识啊、技术啊,不是在互联网这个大百科全书上没有,而是自己搜索不到的问题

参考资料

posted @ 2020-04-18 15:23  191206  阅读(331)  评论(0编辑  收藏  举报