Skip to content

Commit 612c809

Browse files
author
crossin
committed
rose
1 parent 5d9176f commit 612c809

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.DS_Store
12
# Byte-compiled / optimized / DLL files
23
__pycache__/
34
*.py[cod]

ValentinesDay.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#-*- coding: utf-8 -*-
2+
####################################
3+
### 99 rose curves for QXT ###
4+
### Happy Valentine's Day~ ###
5+
### by Crossin ###
6+
####################################
7+
#
8+
# 欢迎关注
9+
# 微信公众号:Crossin的编程教室
10+
# 微信号:crossincode
11+
# 论坛:bbs.crossincode.com
12+
#
13+
14+
import math
15+
rad = 12
16+
heart = u'\u2665'.encode('utf8')
17+
curve = []
18+
for i in range(rad*2+1):
19+
curve.append([])
20+
for j in range(rad*2+1):
21+
curve[i].append(' ')
22+
for n in range(1,100):
23+
print n
24+
for k in range(360):
25+
angle = k * math.pi / 180
26+
x = int(rad * math.sin(n * angle) * math.sin(angle)) + rad
27+
y = int(rad * math.sin(n * angle) * math.cos(angle)) + rad
28+
curve[x][y] = heart
29+
for i in range(rad*2+1):
30+
for j in range(rad*2+1):
31+
print curve[i][j],
32+
curve[i][j] = ' '
33+
print

0 commit comments

Comments
 (0)