Demo entry 6642481

123

   

Submitted by anonymous on Sep 24, 2017 at 12:09
Language: Python 3. Code size: 574 Bytes.

#coding:gbk

from sys import stdout

#for y in map(lambda i:i*0.1,range(15,-15,-1)):
#    for x in map(lambda i:i*0.01,range(-150,150,5)):

try:
	while True:
		try:
			count = input(u'请输入层数,输入0退出程序:')
		except:
			print u'请输入数字!'
		else:
			if count == 0:
				break
		for i in xrange(count):
			for y in map(lambda i:i*0.1,xrange(15,-15,-1)):
				for x in map(lambda i:i*0.01,xrange(-150,150,5)):
					a = x * x + y * y - 1
					stdout.write('*') if a * a * a - x * x * y * y * y <= 0.0 else stdout.write(' ')
				print '\n',
except:
	print u'程序异常退出!'

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).