![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
简单例子
文章平均质量分 66
wakingwind
这个作者很懒,什么都没留下…
展开
-
Python简单实现二元一次方程求根
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import math def my_def(a,b,c): coeffic = [a,b,c] leng = len(coeffic) - 1 for num in coeffic: #限制输入的数据类型 if no...原创 2018-03-15 15:30:02 · 12999 阅读 · 2 评论 -
python相乘
def product(*x, y=(1,)): #测试product((1,),(1,)),tuple或list不能相乘,怎么解决type(x)的类型为int,而不为tuple # result = 1 # if type(x)==list or type(x)==tuple: # for num in x: # result = ...原创 2018-03-16 15:20:39 · 2603 阅读 · 0 评论 -
python3 简单实现杨辉三角
def yanghui(): L = [1] while True: yield L if len(L)==1: L.append(1) else: # for i in range(0,len(L)-1): # temp[i] = L[i]+L[i+1] ...原创 2018-03-22 16:20:02 · 2364 阅读 · 1 评论 -
python3实现简单汉诺塔
#!/usr/bin/env python3 #_*_*_ coding: utf-8 _*_*_ #汉诺塔 # def hannuota(n,N,M): # print("将第%d块从%s移动到第%s" %(n,N,M)) # def nuota(n,A,B,C): # if n==1: # hannuota(1,A,C) # else: ...原创 2018-03-19 09:00:01 · 230 阅读 · 0 评论