python combos-timed.py

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python combos-timed.py相关的知识,希望对你有一定的参考价值。

import time

class Combos:
  count = 1

  def find_combos(self, int_list, above_str):
    for i in range(0, len(int_list)):
      cur_combo = above_str + str(int_list[i])

      temp_list = list(int_list)
      temp_list.pop(i)

      if len(temp_list) != 0:
        self.find_combos(temp_list, cur_combo)
      else:
        print(str(self.count) + ": " + str(cur_combo))
        self.count = self.count + 1


if __name__ == "__main__":
  start_time = time.time()

  combos = Combos()
  combos.find_combos([1,2,3,4,5,6,7,8], "")

  end_time = time.time()
  print("Elapsed time was %g seconds" % (end_time - start_time))

以上是关于python combos-timed.py的主要内容,如果未能解决你的问题,请参考以下文章

001--python全栈--基础知识--python安装

Python代写,Python作业代写,代写Python,代做Python

Python开发

Python,python,python

Python 介绍

Python学习之认识python