ascii-art

Asterisk triangle in python [duplicate]

北城余情 提交于 2019-11-29 08:43:33
This question already has an answer here: How to recreate pyramid triangle? 3 answers I have to write a recursive function asterisk_triangle which takes an integer and then returns an asterisk triangle consisting of that many lines. For e.g this is a 4 line asterisk triangle. * ** *** **** I came up with this function: def asterisk_triangle(n): """ takes an integer n and then returns an asterisk triangle consisting of (n) many lines """ x = 1 while (x <= n): print("*" * x) x = x + 1 return And also I had to create an upside down asterisk triangle by manipulating the first function. I came up

“Fun” C++ library that interprets ASCII figures in code - what is it called? (“Multi-Dimensional Analog Literals”)

邮差的信 提交于 2019-11-28 21:08:13
问题 A while ago I stumbled upon a C++ gem, a set of classes that through operator overloading and possibly some preprocessor tricks, let you define variables using in-code ASCII art: Line x = |-----|; //x is 5 Line y = |---|; //y is 3 Rectangle r = +---+ | | +---+; //r is 3 by 1 and IIRC, it even had support for 3D figures! But for the life of me I cannot remember the name of this library/header file/set of classes. What is it called? 回答1: I believe you are after Multi-Dimensional Analog Literals

How do I print this list vertically?

流过昼夜 提交于 2019-11-28 13:47:26
Let's say I have this list of asterisks, and I say it to print this way: list = ['* *', '*', '* * *', '* * * * *', '* * * * * *', '* * * *'] for i in list: print i So here, the output is: * * * * * * * * * * * * * * * * * * * * * But I want the output to be vertical, like this: * * * * * * * * * * * * * * * * * * * * * Any tips on doing this? I've tried to conceptualize how to use things like list comprehension or for-loops for this, but haven't got it quite right. myList = ['* *', '*', '* * *', '* * * * *', '* * * * * *', '* * * *'] import itertools for i in itertools.izip_longest(*myList,

Pyramid of asterisks program in Python

耗尽温柔 提交于 2019-11-28 12:29:32
I've written a program in C++ that displays a pyramid of asterisk (see below) and now I'd like to see how it's done in Python but it's not as easy as I'd thought it would be. Has anyone tried this and if so could you show me code that would help out? Thanks in advance. * *** ***** ******* ********* *********** ************* *************** def pyramid(rows=8): for i in range(rows): print ' '*(rows-i-1) + '*'*(2*i+1) pyramid(8) * *** ***** ******* ********* *********** ************* *************** pyramid(12) * *** ***** ******* ********* *********** ************* *************** *************

Asterisk art in python

ぃ、小莉子 提交于 2019-11-28 08:13:01
问题 I would like to produce this picture in python! * ** *** **** ***** ****** ******* ******** ********* ********** I entered this: x=1 while x<10: print '%10s' %'*'*x x=x+1 Which sadly seems to produce something composed of the right number of dots as the picture above, but each of those dot asterisks are separated by spaced apart from one another, rather than justified right as a whole. Anybody have a clever mind on how I might achieve what I want? 回答1: '%10s' %'*'*x is being parsed as ('%10s'

Horizontally and vertically center a pre tag without the use of tables?

风流意气都作罢 提交于 2019-11-28 05:46:57
问题 Is it possible to horizontally and vertically align a pre tag without tables? I want to vertically and horizontally align some ASCII art on a webpage. While I have already produced a successful adaption using tables, I want to know if its possible to convert it to using other elements and CSS. Every piece of ASCII art is a different height and width, so therefore it is important to note that the solution to my issue must involve not having a fixed height or width requirement. Thank you. 回答1:

Cooler ASCII Spinners? [closed]

做~自己de王妃 提交于 2019-11-28 02:31:12
In a console app, an ascii spinner can be used, like the GUI wait cursor, to indicate that work is being done. A common spinner cycles through these 4 characters: '|', '/', '-', '\' What are some other cyclical animation sequences to spice up a console application? Balloons... . o O @ * Joe Koberg Lots of choices with Unicode, including ⌚ and ⌛! ← ↖ ↑ ↗ → ↘ ↓ ↙ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▇ ▆ ▅ ▄ ▃ ▁ ▉▊▋▌▍▎▏▎▍▌▋▊▉ ▖ ▘ ▝ ▗ ┤ ┘ ┴ └ ├ ┌ ┬ ┐ ◢ ◣ ◤ ◥ ◰ ◳ ◲ ◱ ◴ ◷ ◶ ◵ ◐ ◓ ◑ ◒ ◡◡ ⊙⊙ ◠◠ ⣾⣽⣻⢿⡿⣟⣯⣷ ⠁⠂⠄⡀⢀⠠⠐⠈ The entire braille block, even in random order http://www.fileformat.info/info/unicode/block/braille_patterns

Asterisk triangle in python [duplicate]

删除回忆录丶 提交于 2019-11-28 02:07:44
问题 This question already has answers here : How to recreate pyramid triangle? (3 answers) Closed 6 years ago . I have to write a recursive function asterisk_triangle which takes an integer and then returns an asterisk triangle consisting of that many lines. For e.g this is a 4 line asterisk triangle. * ** *** **** I came up with this function: def asterisk_triangle(n): """ takes an integer n and then returns an asterisk triangle consisting of (n) many lines """ x = 1 while (x <= n): print("*" *

How would I use some multi line ascii art as my characters for a counter? (batch)

£可爱£侵袭症+ 提交于 2019-11-28 01:46:47
here is the font :: __ ___ ____ _ _ _____ __ ______ ___ ___ ___ :: /_ | |__ \ |___ \ | || | | ____| / / |____ | / _ \ / _ \ / _ \ :: | | ) | __) | | || |_ | |__ / /_ / / | (_) | | (_) | | | | | :: | | / / |__ < |__ _| |___ \ | '_ \ / / > _ < \__, | | | | | :: | | / /_ ___) | | | ___) | | (_) | / / | (_) | / / | |_| | :: |_| |____| |____/ |_| |____/ \___/ /_/ \___/ /_/ \___/ Honestly I have no idea on how to refer to multiple line characters right next to each other.. Give this a try :) @echo off echo The digits: call :printNum 0123456789 echo( echo The answer to life, the universe, and

PPM image to ASCII art in Python

吃可爱长大的小学妹 提交于 2019-11-27 20:18:15
I have to make a program that reads in a file from the command line and covert it to ASCII art. I am using PPM format and here is a link to the project . Here is what I have so far: import sys def main(filename): image = open(filename) #reads through the first three lines color = image.readline().splitlines() size_width, size_height = image.readline().split() max_color = image.readline().splitlines() #reads the body of the file pixels = image.read().split() red = 0 green = 0 blue = 0 r_g_b_value = [] #pulls out the values of each tuple and coverts it to its grayscale value for i in pixels: if