Entry 5629

Some code

   

Submitted by plastinin on July 31, 2010 at 6:59 p.m.
Language: Python 3. Code size: 2.2 KB.

>>> def show_number(number):
	one = [ "   ****   ", "      *   ", "      *   ", "      *   ", "      *   ", "      *   ", "      *   "]
	two = [ "  ******  ", "  *    *  ", "      *   ", "    *     ", "   *      ", "  *    *  ", "  ******  "]
	three = [ "  ******  ", "      *   ", "     *    ", "    *     ", "     *    ", "      *   ", "  ******  "]
	four = [ "  *    *  ", "  *    *  ", "  *    *  ", "  ******  ", "       *  ", "       *  ", "       *  "]
	five = [ "  ******  ", "  *       ", "  *       ", "  ******  ", "       *  ", "       *  ", "  ******  "]
	six = [ "  ******  ", "  *       ", "  *       ", "  ******  ", "  *    *  ", "  *    *  ", "  ******  " ]
	seven = [ "  ******   ", "      *   ", "    *     ", "    *     ", "    *     ", "    *     ", "    *     "]
	eight = [ " ******  ", "  *    *  ", "  *    *  ", "  ******  ", "  *    *  ", "  *    *  ", "  ******  " ]
	nine = [ "  ******  ", "  *    *  ", "  *    *  ", "  ******  ", "       *  ", "       *  ", "       *  " ]
	zero = [ "  ******  ", "  *    *  ", "  *    *  ", "  *    *  ", "  *    *  ", "  *    *  ", "  ******  " ]
	digits = [one, two, three, four, five, six, seven, eight, nine, zero]
	str_numbers = str(number) # предполагается, что numbers типа int
	line = 0
	while line < 7:
		current_line = "";
		for ch in str_numbers:
			current_line += digits[int(ch) - 1][line] + " "
		print(current_line)
		line += 1

		
>>> show_number(1234567890)
   ****      ******     ******     *    *     ******     ******     ******     ******     ******     ******   
      *      *    *         *      *    *     *          *              *      *    *     *    *     *    *   
      *          *         *       *    *     *          *            *        *    *     *    *     *    *   
      *        *          *        ******     ******     ******       *        ******     ******     *    *   
      *       *            *            *          *     *    *       *        *    *          *     *    *   
      *      *    *         *           *          *     *    *       *        *    *          *     *    *   
      *      ******     ******          *     ******     ******       *        ******          *     ******   

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).