Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 707fb3e

Browse files
submit code
1 parent 33dacc7 commit 707fb3e

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

‎chaoxi/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
+ [Earth_view](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/Earth_view) :如何用 Python 制作地球仪?
88
+ [twoai_chat](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/twoai_chat) :两个机器人在一起会碰撞出怎样的的火花?
99
+ [Matplotlib_3D](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/Matplotlib_3D) :Python 30 行代码画各种 3D 图形
10+
+ [five_code](https://github.com/JustDoPython/python-examples/tree/master/chaoxi/five_code) :Python 5 行代码的神奇操作!
11+
1012

1113
---
1214

‎chaoxi/five_code/baidu_code.png

696 Bytes
Loading[フレーム]

‎chaoxi/five_code/five_code.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# 5 行代码写服务器
2+
from http import server
3+
from http.server import SimpleHTTPRequestHandler
4+
server_address = ('127.0.0.1', 8080)
5+
httpd = server.HTTPServer(server_address, SimpleHTTPRequestHandler)
6+
httpd.serve_forever()
7+
8+
9+
# 加法计算器
10+
num1 = input("第一个数:")
11+
num2 = input("第二个数:")
12+
new_num1 = int(num1)
13+
new_num2 = int(num2)
14+
print(new_num1 + new_num2)
15+
16+
# 兔子问题
17+
# #古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少?
18+
def count(n):
19+
if (1 == n or 2 == n):
20+
return 1
21+
elif (n >= 2):
22+
return count(n - 2) + count(n - 1)
23+
print(count(36) * 2)
24+
25+
26+
# 吗呢问答
27+
while(True):
28+
question = input()
29+
answer = question.replace('吗', '呢')
30+
answer = answer.replace('?', '!')
31+
print(answer)
32+
33+
34+
# 九九乘法表1
35+
for i in range(1, 10):
36+
for j in range(1, i+1):
37+
print('{}x{}={}\t'.format(j, i, i*j), end='')
38+
print()
39+
40+
# 九九乘法表 2
41+
for i in range(1, 10):
42+
for j in range(i, 10):
43+
print(f'{i}x{j}={i*j}',end='\t')
44+
print(" ")
45+
print("\n")
46+
47+
# 逆序打印数字
48+
def nixu(n):
49+
l = str(n)
50+
l_str = l[::-1]
51+
print("逆序:%s" % ( l_str))
52+
nixu(2020)
53+
54+
55+
from wordcloud import WordCloud
56+
import PIL.Image as image
57+
58+
with open('wordcloud.txt') as fp:
59+
text = fp.read()
60+
wordcloud = WordCloud().generate(text)
61+
img = wordcloud.to_image()
62+
img.show()
63+
64+
# 快捷二维码生成
65+
from MyQR import myqr
66+
myqr.run(
67+
words='https://www.baidu.com/',
68+
colorized=True,
69+
save_name='baidu_code.png')
70+
71+

‎chaoxi/five_code/wordcloud.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
if you want to grow up,you are welcome to learn python!

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /