• 软件工程第1次作业---词频统计


    要求0

    https://edu.cnblogs.com/campus/nenu/2016CS/homework/2110

    要求1

    https://git.coding.net/neneee/wf.git

    要求2

    PSP阶段表格

       功能模块

    具体阶段

    预计所需时间(min)

    实际所需时间(min)

       功能1

    具体设计

    具体编码

    测试完善

    25

    130

    20

    30

    50

    60

       功能2

    具体设计

    具体编码

    测试完善

    30

    145

    20

    10

    60

    50

       功能3

    具体设计

    具体编码

    测试完善

    40

    210

    30

    10

    110

    40

       总计

     

    300

    420

    对比预估耗时和实际耗时的差距,分析原因

      预估与实际耗时差距主要在于查询相关方法时,网络资源林林总总,并非所有可用。

      需要寻找适合自己平台的方法。

    要求3

    1.解题思路:

      边编边设计或许是个好方法

      边编边查资料或许是个好方法

      解决:控制台输入->单词计数->输出格式 

    2.难点:

      python是个很好的语言,功能强大,很多方法是现成的。

    在功能三的输出格式上 先按value降序 后按key升序 没有找到合适的方法 于是迂回实现

     1               maxKey= max(dic.values())
     2               for key in dic.keys():
     3                      count = count + 1
     4                      dic[key] = maxKey - dic[key]
     5               
     6               print('Total words is {count}'.format(count = count))
     7               print('----------')
     8               #按value从高到低排序
     9               #dic = sorted(dic.items(),key = lambda x:x[1],reverse = True)
    10               dic = sorted(dic.items(), key=lambda x:(x[1],x[0]))
    11               dic = dict(dic)
    12               count = 0
    13               for key,value in dic.items():
    14                      count += 1
    15                      if count > num:
    16                             break
    17                      print('%-20s %d'%(key,maxKey - value))             

    在此po出参考链接:

    python文件的打开和读取 https://www.cnblogs.com/sakura3/p/8401240.html
    Python 获得命令行参数的方法 https://www.cnblogs.com/saiwa/articles/5253713.html
    python函数 http://www.runoob.com/python/python-functions.html
    python中的is、==和cmp()比较字符串 https://www.cnblogs.com/nkwy2012/p/6023719.html
    python 数组的del ,remove,pop区别 https://blog.csdn.net/anneqiqi/article/details/71057069
    python获取程序执行文件路径方法 https://blog.csdn.net/py_tester/article/details/78954034
    正则表达式 https://blog.csdn.net/qq_28633249/article/details/77686976
    Python中dict的各种打印方式 https://blog.csdn.net/ngy321/article/details/79994788
    Python格式化输出 https://www.cnblogs.com/plwang1990/p/3757549.html
    python 对字典按照value进行排序 https://blog.csdn.net/a857553315/article/details/79575623
    Python中字典根据多项规则排序 https://blog.csdn.net/songbinxu/article/details/80417861
    将python源文件打包成exe文件 https://blog.csdn.net/u010812071/article/details/78507946

    3.功能实现:

    4.不足:

    将python打包成exe,利用pyinstaller总是报错,lib is not fund

    心累

    写博客的时间比完成一个功能还长。。。

    5.心路历程:

    学习与编码的过程是愉快的 努力实现功能也是愉快的 但这样码字真的很不愉快

  • 相关阅读:
    基于LBS(GPS)和ArcGIS的ITS智能交通 路况服务架构
    入手ipod touch4
    改2字节将Win XP Home变成Pro?!(zz)
    越来越多的同学在MSN上建Blog了……
    有了64位的芯不一定能运行64位OS?(zz)
    C++字符串完全指引之二——字符串封装类(zz)
    忙……
    注意C#中的ref及out关键字
    期待CGFTP 1.0正式版:)
    真伪双核 英特尔双核平台深度揭秘(zz)
  • 原文地址:https://www.cnblogs.com/gongyl212/p/9689904.html
Copyright © 2020-2023  润新知