用于matplotlib对齐很有用的算法,可用于面试笔试
生活随笔
收集整理的這篇文章主要介紹了
用于matplotlib对齐很有用的算法,可用于面试笔试
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
def aa(bottom, top):? ? if abs(bottom) > abs(int(bottom)):
? ? ? ? bottom -= 1
? ? if abs(top) > abs(int(top)):
? ? ? ? top += 1
? ? gip = (top - bottom)/5.0
? ? flag = False
? ? while abs((gip - bottom)/gip) > abs(int((gip - bottom)/gip)):
? ? ? ? flag = not flag
? ? ? ? if flag:
? ? ? ? ? ? top += 1
? ? ? ? ? ? gip = (top - bottom)/5.0
? ? ? ? else:
? ? ? ? ? ? bottom -= 1
? ? ? ? ? ? gip = (top - bottom)/5.0
? ? return bottom, gip, top
if __name__ == "__main__":
? ? print aa(-1,6)
轉載于:https://my.oschina.net/u/1010413/blog/161172
總結
以上是生活随笔為你收集整理的用于matplotlib对齐很有用的算法,可用于面试笔试的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android 颜色渲染(二) 颜色区域
- 下一篇: 理解并取证:DLS网络架构和PPPOE数