Some Python Phrase you should never write
Example 1 Never write: [[0] * 5] * 10 this clause you can only use once, [0] * 5, like this. But if you use [[0] * 5] * 10 instead of [[0]*5 for _ in range(10)], that will make your variable sh...
Example 1 Never write: [[0] * 5] * 10 this clause you can only use once, [0] * 5, like this. But if you use [[0] * 5] * 10 instead of [[0]*5 for _ in range(10)], that will make your variable sh...
Very short conclusion: at least two traversal can uniquely a tree from the traversal, and one must be inorder traversal.
The problems come from the book A First Course in Probability by Sheldon Ross. But I am really sorry since I forgot where the solution I saw, maybe another book, Wikipedia, or maybe some other onli...
Personally, I believe the iPhone 17 is the most worthwhile option in the new series. Released on September 9, 2025, the iPhone 17 brings a significant balance between price and performance, much li...
At Seattle. Before landing, a warehouse? of Boeing. You know, Boeing is located at Seattle. Airbus A350-941 (reg N505DN) of Delta Airlines (DL). A very cutting-edge model, strongly recommend by ...
权限管理是开发中常见的场景,传统方法可能依赖数组、字典或数据库,尤其是在权限很多的情况下,大量的变量命名以及重复运用会增加代码的复杂度,而且更容易出错。今天分享如何用 位运算 来管理权限,包括 赋予、移除 和 检查 操作。 什么是位运算? 位运算是直接对整数的二进制位进行操作的方式。Python 提供了多种位运算符,例如: &(按位与):两个对应位都为 1 时结果为 1。 ...
因为我的博客是GitHub Pages搭建的,纯静态也主打迁移方便。当然今天写文章的时候报错了。 build The current runner (ubuntu-24.04-x64) was detected as self-hosted because the platform does not match a GitHub-hosted runner image (or tha...
用户会给你填写奇奇怪怪的东西,你想好怎么应对了吗?今天在刷leetcode的pandas,2885. Rename Columns,有感而发。 直接看题目吧,其实很简单,但是我现在会想,万一有的测试样例里面,Column Name不是这四个,或者顺序错了怎么办。偷懒可以直接令columns = [,,,,,,],但是如果顺序不对,缺少或者更多,程序都会报错。 DataFrame s...
Except the inbox, he must check his junk box every day.
杠杆ETF,英文Leveraged ETF,这是一种更为安全的杠杆投资方式。杠杆ETF相当于在原始投资标的的基础上添加了杠杆,其每日涨跌幅是追踪标的的杠杆倍数。 我们投资纳斯达克指数可以通过纳斯达克ETF(QQQ),当我们看多的时候,为了增加收益,可以买入两倍做多纳斯达克ETF(QLD)、三倍做多纳斯达克(TQQQ)。QLD每日涨幅是QQQ的两倍。同样的,看空的时候也可以买入做空是纳斯达克...