Skip to content

Instantly share code, notes, and snippets.

View xuzhengfu's full-sized avatar
🎯
Focusing

zhengfu xuzhengfu

🎯
Focusing
View GitHub Profile
@xuzhengfu
xuzhengfu / zhengfu.py
Created July 19, 2020 06:40
Zhengfu's assignment #1
import random
import requests
from time import sleep
from pypinyin import lazy_pinyin
from termcolor import colored
from simpleeval import simple_eval
class Bot:
@xuzhengfu
xuzhengfu / prime_num.py
Last active August 1, 2020 15:24
Zhengfu's assignment #2
from math import sqrt
from itertools import islice
def is_prime(num):
if num in (2, 3):
return True
for factor in range(2, int(sqrt(num)) + 1):
if num % factor == 0:
@xuzhengfu
xuzhengfu / treenode.py
Last active September 3, 2020 07:51
zhengfu's assignment #3
# coding=utf-8
class TreeNode:
def __init__(self, name='root', data=None, parent=None, children=None):
self.name = name
self.data = data
if parent:
assert isinstance(parent, TreeNode)
parent.add_child(self)